'Testing a configmap create'

@mock.patch('oc_configmap.Utils._write')
@mock.patch('oc_configmap.Utils.create_tmpfile_copy')
@mock.patch('oc_configmap.OCConfigMap._run')
def test_create_configmap(self, mock_run, mock_tmpfile_copy, mock_write):

    return
    params = copy.deepcopy(OCConfigMapTest.params)
    params['from_file'] = {'test': '/root/file'}
    params['from_literal'] = {'foo': 'bar'}
    configmap = '{\n                                                                "apiVersion":    "v1",\n                                                                "data":    {\n                                                                                "foo":    "bar",\n                                                                                "test":    "this    is    a    file\\n"\n                                                                },\n                                                                "kind":    "ConfigMap",\n                                                                "metadata":    {\n                                                                                "creationTimestamp":    "2017-03-20T20:24:35Z",\n                                                                                "name":    "configmap",\n                                                                                "namespace":    "test"\n                                                                }\n                                                }'
    mock_run.side_effect = [(1, '', 'Error    from    server    (NotFound):    configmaps    "configmap"    not    found'), (0, '', ''), (0, configmap, '')]
    mock_tmpfile_copy.side_effect = ['/tmp/mocked_kubeconfig']
    results = OCConfigMap.run_ansible(params, False)
    self.assertTrue(results['changed'])
    self.assertEqual(results['results']['results'][0]['metadata']['name'], 'configmap')
