'Testing a group create'

@mock.patch('oc_group.Utils.create_tmpfile_copy')
@mock.patch('oc_group.OCGroup._run')
def test_create_group(self, mock_run, mock_tmpfile_copy):

    params = copy.deepcopy(OCGroupTest.params)
    group = '{\n                                                "kind":    "Group",\n                                                "apiVersion":    "v1",\n                                                "metadata":    {\n                                                                "name":    "acme"\n                                                },\n                                                "users":    []\n                                }'
    mock_run.side_effect = [(1, '', 'Error    from    server:    groups    "acme"    not    found'), (1, '', 'Error    from    server:    groups    "acme"    not    found'), (0, '', ''), (0, group, '')]
    mock_tmpfile_copy.side_effect = ['/tmp/mocked_kubeconfig']
    results = OCGroup.run_ansible(params, False)
    self.assertTrue(results['changed'])
    self.assertEqual(results['results']['results'][0]['metadata']['name'], 'acme')
