diff options
Diffstat (limited to 'roles/lib_openshift/src/test')
-rwxr-xr-x | roles/lib_openshift/src/test/integration/group.yml | 229 | ||||
-rwxr-xr-x | roles/lib_openshift/src/test/integration/oc_adm_manage_node.yml (renamed from roles/lib_openshift/src/test/integration/oadm_manage_node.yml) | 8 | ||||
-rwxr-xr-x | roles/lib_openshift/src/test/unit/test_oc_adm_manage_node.py (renamed from roles/lib_openshift/src/test/unit/test_oadm_manage_node.py) | 14 | ||||
-rwxr-xr-x | roles/lib_openshift/src/test/unit/test_oc_group.py | 253 | ||||
-rwxr-xr-x | roles/lib_openshift/src/test/unit/test_oc_project.py | 200 | ||||
-rwxr-xr-x | roles/lib_openshift/src/test/unit/test_oc_route.py | 2 |
6 files changed, 679 insertions, 27 deletions
diff --git a/roles/lib_openshift/src/test/integration/group.yml b/roles/lib_openshift/src/test/integration/group.yml new file mode 100755 index 000000000..25aa5727b --- /dev/null +++ b/roles/lib_openshift/src/test/integration/group.yml @@ -0,0 +1,229 @@ +#!/usr/bin/ansible-playbook +--- +- hosts: "{{ cli_master_test }}" + gather_facts: no + user: root + + vars: + + post_tasks: + - name: delete test group (so future tests work) + oc_group: + state: absent + name: jgroup + + - name: delete 2nd test group (so future tests work) + oc_group: + state: absent + name: jgroup2 + + - name: delete test user (so future tests work) + oc_user: + state: absent + username: jdiaz@redhat.com + + - name: get group list + oc_group: + state: list + name: jgroup + register: group_out + #- debug: var=group_out + - name: assert group 'jgroup' (test group) does not exist + assert: + that: group_out['results'][0] == {} + + - name: get group list + oc_group: + state: list + name: jgroup2 + register: group_out + #- debug: var=group_out + - name: assert group 'jgroup2' (test group) does not exist + assert: + that: group_out['results'][0] == {} + + - name: get user list + oc_user: + state: list + username: 'jdiaz@redhat.com' + register: group_out + #- debug: var=group_out + - name: assert user 'jdiaz@redhat.com' (test user) does not exist + assert: + that: group_out['results'][0] == {} + + - name: create group + oc_group: + state: present + name: jgroup + register: group_out + #- debug: var=group_out + - name: assert creating group marked changed + assert: + that: group_out['changed'] == True + + - name: list group + oc_group: + state: list + name: jgroup + register: group_out + #- debug: var=group_out + - name: assert group actually created + assert: + that: group_out['results'][0]['metadata']['name'] == 'jgroup' + + - name: re-add group + oc_group: + state: present + name: jgroup + register: group_out + #- debug: var=group_out + - name: assert re-adding group marked not changed + assert: + that: group_out['changed'] == False + + + - name: add user with group membership + oc_user: + state: present + username: jdiaz@redhat.com + full_name: Joel Diaz + groups: + - jgroup + register: group_out + #- debug: var=group_out + + - name: get group + oc_group: + state: list + name: jgroup + register: group_out + - name: assert user in group + assert: + that: group_out['results'][0]['users'][0] == 'jdiaz@redhat.com' + + - name: add 2nd group + oc_group: + state: present + name: jgroup2 + + - name: change group membership + oc_user: + state: present + username: jdiaz@redhat.com + full_name: Joel Diaz + groups: + - jgroup2 + register: group_out + - name: assert result changed + assert: + that: group_out['changed'] == True + + - name: check jgroup user membership + oc_group: + state: list + name: jgroup + register: group_out + #- debug: var=group_out + - name: assert user not present in previous group + assert: + that: group_out['results'][0]['users'] == [] + + - name: check jgroup2 user membership + oc_group: + state: list + name: jgroup2 + register: group_out + #- debug: var=group_out + - name: assert user present in new group + assert: + that: group_out['results'][0]['users'][0] == 'jdiaz@redhat.com' + + - name: multi-group membership + oc_user: + state: present + username: jdiaz@redhat.com + full_name: Joel Diaz + groups: + - jgroup + - jgroup2 + register: group_out + - name: assert result changed + assert: + that: group_out['changed'] == True + + - name: check jgroup user membership + oc_group: + state: list + name: jgroup + register: group_out + #- debug: var=group_out + - name: assert user present in group + assert: + that: group_out['results'][0]['users'][0] == 'jdiaz@redhat.com' + + - name: check jgroup2 user membership + oc_group: + state: list + name: jgroup2 + register: group_out + #- debug: var=group_out + - name: assert user still present in group + assert: + that: group_out['results'][0]['users'][0] == 'jdiaz@redhat.com' + + - name: user delete (group cleanup) + oc_user: + state: absent + username: jdiaz@redhat.com + register: group_out + + - name: get user list for jgroup + oc_group: + state: list + name: jgroup + register: group_out + #- debug: var=group_out + - name: assert that group jgroup has no members + assert: + that: group_out['results'][0]['users'] == [] + + - name: get user list for jgroup2 + oc_group: + state: list + name: jgroup2 + register: group_out + #- debug: var=group_out + - name: assert that group jgroup2 has no members + assert: + that: group_out['results'][0]['users'] == [] + + - name: user without groups defined + oc_user: + state: present + username: jdiaz@redhat.com + full_name: Joel Diaz + register: group_out + - name: assert result changed + assert: + that: group_out['changed'] == True + + - name: check jgroup user membership + oc_group: + state: list + name: jgroup + register: group_out + #- debug: var=group_out + - name: assert user not present in group + assert: + that: group_out['results'][0]['users'] == [] + + - name: check jgroup2 user membership + oc_group: + state: list + name: jgroup2 + register: group_out + #- debug: var=group_out + - name: assert user not present in group + assert: + that: group_out['results'][0]['users'] == [] diff --git a/roles/lib_openshift/src/test/integration/oadm_manage_node.yml b/roles/lib_openshift/src/test/integration/oc_adm_manage_node.yml index 3ee13a409..1ed2ef11b 100755 --- a/roles/lib_openshift/src/test/integration/oadm_manage_node.yml +++ b/roles/lib_openshift/src/test/integration/oc_adm_manage_node.yml @@ -1,6 +1,6 @@ #!/usr/bin/ansible-playbook --module-path=../../../library/ # -# ./oadm_manage_node.yml -e "cli_master_test=$OPENSHIFT_MASTER +# ./oc_adm_manage_node.yml -e "cli_master_test=$OPENSHIFT_MASTER --- - hosts: "{{ cli_master_test }}" gather_facts: no @@ -17,7 +17,7 @@ node_to_test: "{{ obj_out['results']['results'][0]['items'][0]['metadata']['name'] }}" - name: list pods from a node - oadm_manage_node: + oc_adm_manage_node: list_pods: True node: - "{{ node_to_test }}" @@ -29,7 +29,7 @@ msg: Pod data was not returned - name: set node to unschedulable - oadm_manage_node: + oc_adm_manage_node: schedulable: False node: - "{{ node_to_test }}" @@ -56,7 +56,7 @@ that: nodeout.results.results[0]['spec']['unschedulable'] - name: set node to schedulable - oadm_manage_node: + oc_adm_manage_node: schedulable: True node: - "{{ node_to_test }}" diff --git a/roles/lib_openshift/src/test/unit/test_oadm_manage_node.py b/roles/lib_openshift/src/test/unit/test_oc_adm_manage_node.py index 27d98b869..312b1ecbb 100755 --- a/roles/lib_openshift/src/test/unit/test_oadm_manage_node.py +++ b/roles/lib_openshift/src/test/unit/test_oc_adm_manage_node.py @@ -1,5 +1,5 @@ ''' - Unit tests for oadm_manage_node + Unit tests for oc_adm_manage_node ''' import os @@ -16,16 +16,16 @@ import mock # place class in our python path module_path = os.path.join('/'.join(os.path.realpath(__file__).split('/')[:-4]), 'library') # noqa: E501 sys.path.insert(0, module_path) -from oadm_manage_node import ManageNode, locate_oc_binary # noqa: E402 +from oc_adm_manage_node import ManageNode, locate_oc_binary # noqa: E402 class ManageNodeTest(unittest.TestCase): ''' - Test class for oadm_manage_node + Test class for oc_adm_manage_node ''' - @mock.patch('oadm_manage_node.Utils.create_tmpfile_copy') - @mock.patch('oadm_manage_node.ManageNode.openshift_cmd') + @mock.patch('oc_adm_manage_node.Utils.create_tmpfile_copy') + @mock.patch('oc_adm_manage_node.ManageNode.openshift_cmd') def test_list_pods(self, mock_openshift_cmd, mock_tmpfile_copy): ''' Testing a get ''' params = {'node': ['ip-172-31-49-140.ec2.internal'], @@ -107,8 +107,8 @@ class ManageNodeTest(unittest.TestCase): # returned 2 pods self.assertTrue(len(results['results']['nodes']['ip-172-31-49-140.ec2.internal']) == 2) - @mock.patch('oadm_manage_node.Utils.create_tmpfile_copy') - @mock.patch('oadm_manage_node.ManageNode.openshift_cmd') + @mock.patch('oc_adm_manage_node.Utils.create_tmpfile_copy') + @mock.patch('oc_adm_manage_node.ManageNode.openshift_cmd') def test_schedulable_false(self, mock_openshift_cmd, mock_tmpfile_copy): ''' Testing a get ''' params = {'node': ['ip-172-31-49-140.ec2.internal'], diff --git a/roles/lib_openshift/src/test/unit/test_oc_group.py b/roles/lib_openshift/src/test/unit/test_oc_group.py new file mode 100755 index 000000000..8eef37810 --- /dev/null +++ b/roles/lib_openshift/src/test/unit/test_oc_group.py @@ -0,0 +1,253 @@ +''' + Unit tests for oc group +''' + +import copy +import os +import six +import sys +import unittest +import mock + +# Removing invalid variable names for tests so that I can +# keep them brief +# pylint: disable=invalid-name,no-name-in-module +# Disable import-error b/c our libraries aren't loaded in jenkins +# pylint: disable=import-error,wrong-import-position +# place class in our python path +module_path = os.path.join('/'.join(os.path.realpath(__file__).split('/')[:-4]), 'library') # noqa: E501 +sys.path.insert(0, module_path) +from oc_group import OCGroup, locate_oc_binary # noqa: E402 + + +class OCGroupTest(unittest.TestCase): + ''' + Test class for OCGroup + ''' + params = {'kubeconfig': '/etc/origin/master/admin.kubeconfig', + 'state': 'present', + 'debug': False, + 'name': 'acme', + 'namespace': 'test'} + + @mock.patch('oc_group.Utils.create_tmpfile_copy') + @mock.patch('oc_group.OCGroup._run') + def test_create_group(self, mock_run, mock_tmpfile_copy): + ''' Testing a group create ''' + params = copy.deepcopy(OCGroupTest.params) + + group = '''{ + "kind": "Group", + "apiVersion": "v1", + "metadata": { + "name": "acme" + }, + "users": [] + }''' + + 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') + + @mock.patch('oc_group.Utils.create_tmpfile_copy') + @mock.patch('oc_group.OCGroup._run') + def test_failed_get_group(self, mock_run, mock_tmpfile_copy): + ''' Testing a group create ''' + params = copy.deepcopy(OCGroupTest.params) + params['state'] = 'list' + params['name'] = 'noexist' + + mock_run.side_effect = [ + (1, '', 'Error from server: groups "acme" not found'), + ] + + mock_tmpfile_copy.side_effect = [ + '/tmp/mocked_kubeconfig', + ] + + results = OCGroup.run_ansible(params, False) + + self.assertTrue(results['failed']) + + @mock.patch('oc_group.Utils.create_tmpfile_copy') + @mock.patch('oc_group.OCGroup._run') + def test_delete_group(self, mock_run, mock_tmpfile_copy): + ''' Testing a group create ''' + params = copy.deepcopy(OCGroupTest.params) + params['state'] = 'absent' + + group = '''{ + "kind": "Group", + "apiVersion": "v1", + "metadata": { + "name": "acme" + }, + "users": [ + "user1" + ] + }''' + + mock_run.side_effect = [ + (0, group, ''), + (0, '', ''), + ] + + mock_tmpfile_copy.side_effect = [ + '/tmp/mocked_kubeconfig', + ] + + results = OCGroup.run_ansible(params, False) + + self.assertTrue(results['changed']) + + @mock.patch('oc_group.Utils.create_tmpfile_copy') + @mock.patch('oc_group.OCGroup._run') + def test_get_group(self, mock_run, mock_tmpfile_copy): + ''' Testing a group create ''' + params = copy.deepcopy(OCGroupTest.params) + params['state'] = 'list' + + group = '''{ + "kind": "Group", + "apiVersion": "v1", + "metadata": { + "name": "acme" + }, + "users": [ + "user1" + ] + }''' + + mock_run.side_effect = [ + (0, group, ''), + ] + + mock_tmpfile_copy.side_effect = [ + '/tmp/mocked_kubeconfig', + ] + + results = OCGroup.run_ansible(params, False) + + self.assertFalse(results['changed']) + self.assertEqual(results['results'][0]['metadata']['name'], 'acme') + self.assertEqual(results['results'][0]['users'][0], 'user1') + + @unittest.skipIf(six.PY3, 'py2 test only') + @mock.patch('os.path.exists') + @mock.patch('os.environ.get') + def test_binary_lookup_fallback(self, mock_env_get, mock_path_exists): + ''' Testing binary lookup fallback ''' + + mock_env_get.side_effect = lambda _v, _d: '' + + mock_path_exists.side_effect = lambda _: False + + self.assertEqual(locate_oc_binary(), 'oc') + + @unittest.skipIf(six.PY3, 'py2 test only') + @mock.patch('os.path.exists') + @mock.patch('os.environ.get') + def test_binary_lookup_in_path(self, mock_env_get, mock_path_exists): + ''' Testing binary lookup in path ''' + + oc_bin = '/usr/bin/oc' + + mock_env_get.side_effect = lambda _v, _d: '/bin:/usr/bin' + + mock_path_exists.side_effect = lambda f: f == oc_bin + + self.assertEqual(locate_oc_binary(), oc_bin) + + @unittest.skipIf(six.PY3, 'py2 test only') + @mock.patch('os.path.exists') + @mock.patch('os.environ.get') + def test_binary_lookup_in_usr_local(self, mock_env_get, mock_path_exists): + ''' Testing binary lookup in /usr/local/bin ''' + + oc_bin = '/usr/local/bin/oc' + + mock_env_get.side_effect = lambda _v, _d: '/bin:/usr/bin' + + mock_path_exists.side_effect = lambda f: f == oc_bin + + self.assertEqual(locate_oc_binary(), oc_bin) + + @unittest.skipIf(six.PY3, 'py2 test only') + @mock.patch('os.path.exists') + @mock.patch('os.environ.get') + def test_binary_lookup_in_home(self, mock_env_get, mock_path_exists): + ''' Testing binary lookup in ~/bin ''' + + oc_bin = os.path.expanduser('~/bin/oc') + + mock_env_get.side_effect = lambda _v, _d: '/bin:/usr/bin' + + mock_path_exists.side_effect = lambda f: f == oc_bin + + self.assertEqual(locate_oc_binary(), oc_bin) + + @unittest.skipIf(six.PY2, 'py3 test only') + @mock.patch('shutil.which') + @mock.patch('os.environ.get') + def test_binary_lookup_fallback_py3(self, mock_env_get, mock_shutil_which): + ''' Testing binary lookup fallback ''' + + mock_env_get.side_effect = lambda _v, _d: '' + + mock_shutil_which.side_effect = lambda _f, path=None: None + + self.assertEqual(locate_oc_binary(), 'oc') + + @unittest.skipIf(six.PY2, 'py3 test only') + @mock.patch('shutil.which') + @mock.patch('os.environ.get') + def test_binary_lookup_in_path_py3(self, mock_env_get, mock_shutil_which): + ''' Testing binary lookup in path ''' + + oc_bin = '/usr/bin/oc' + + mock_env_get.side_effect = lambda _v, _d: '/bin:/usr/bin' + + mock_shutil_which.side_effect = lambda _f, path=None: oc_bin + + self.assertEqual(locate_oc_binary(), oc_bin) + + @unittest.skipIf(six.PY2, 'py3 test only') + @mock.patch('shutil.which') + @mock.patch('os.environ.get') + def test_binary_lookup_in_usr_local_py3(self, mock_env_get, mock_shutil_which): + ''' Testing binary lookup in /usr/local/bin ''' + + oc_bin = '/usr/local/bin/oc' + + mock_env_get.side_effect = lambda _v, _d: '/bin:/usr/bin' + + mock_shutil_which.side_effect = lambda _f, path=None: oc_bin + + self.assertEqual(locate_oc_binary(), oc_bin) + + @unittest.skipIf(six.PY2, 'py3 test only') + @mock.patch('shutil.which') + @mock.patch('os.environ.get') + def test_binary_lookup_in_home_py3(self, mock_env_get, mock_shutil_which): + ''' Testing binary lookup in ~/bin ''' + + oc_bin = os.path.expanduser('~/bin/oc') + + mock_env_get.side_effect = lambda _v, _d: '/bin:/usr/bin' + + mock_shutil_which.side_effect = lambda _f, path=None: oc_bin + + self.assertEqual(locate_oc_binary(), oc_bin) diff --git a/roles/lib_openshift/src/test/unit/test_oc_project.py b/roles/lib_openshift/src/test/unit/test_oc_project.py index 5155101cb..fa454d035 100755 --- a/roles/lib_openshift/src/test/unit/test_oc_project.py +++ b/roles/lib_openshift/src/test/unit/test_oc_project.py @@ -2,6 +2,7 @@ Unit tests for oc project ''' +import copy import os import sys import unittest @@ -20,9 +21,22 @@ from oc_project import OCProject # noqa: E402 class OCProjectTest(unittest.TestCase): ''' - Test class for OCSecret + Test class for OCProject ''' + # run_ansible input parameters + params = { + 'state': 'present', + 'display_name': 'operations project', + 'name': 'operations', + 'node_selector': ['ops_only=True'], + 'kubeconfig': '/etc/origin/master/admin.kubeconfig', + 'debug': False, + 'admin': None, + 'admin_role': 'admin', + 'description': 'All things operations project', + } + @mock.patch('oc_project.locate_oc_binary') @mock.patch('oc_project.Utils.create_tmpfile_copy') @mock.patch('oc_project.Utils._write') @@ -30,21 +44,9 @@ class OCProjectTest(unittest.TestCase): def test_adding_a_project(self, mock_cmd, mock_write, mock_tmpfile_copy, mock_loc_oc_bin): ''' Testing adding a project ''' - # Arrange + params = copy.deepcopy(OCProjectTest.params) # run_ansible input parameters - params = { - 'state': 'present', - 'display_name': 'operations project', - 'name': 'operations', - 'node_selector': ['ops_only=True'], - 'kubeconfig': '/etc/origin/master/admin.kubeconfig', - 'debug': False, - 'admin': None, - 'admin_role': 'admin', - 'description': 'All things operations project', - } - project_results = '''{ "kind": "Project", "apiVersion": "v1", @@ -90,7 +92,6 @@ class OCProjectTest(unittest.TestCase): ] # Act - results = OCProject.run_ansible(params, False) # Assert @@ -108,3 +109,172 @@ class OCProjectTest(unittest.TestCase): mock.call(['oc', 'get', 'namespace', 'operations', '-o', 'json'], None), ]) + + @mock.patch('oc_project.locate_oc_binary') + @mock.patch('oc_project.Utils.create_tmpfile_copy') + @mock.patch('oc_project.Utils._write') + @mock.patch('oc_project.OCProject._run') + def test_modifying_a_project_no_attributes(self, mock_cmd, mock_write, mock_tmpfile_copy, mock_loc_oc_bin): + ''' Testing adding a project ''' + params = copy.deepcopy(self.params) + params['display_name'] = None + params['node_selector'] = None + params['description'] = None + + # run_ansible input parameters + project_results = '''{ + "kind": "Project", + "apiVersion": "v1", + "metadata": { + "name": "operations", + "selfLink": "/oapi/v1/projects/operations", + "uid": "5e52afb8-ee33-11e6-89f4-0edc441d9666", + "resourceVersion": "1584", + "labels": {}, + "annotations": { + "openshift.io/node-selector": "", + "openshift.io/description: "This is a description", + "openshift.io/sa.initialized-roles": "true", + "openshift.io/sa.scc.mcs": "s0:c3,c2", + "openshift.io/sa.scc.supplemental-groups": "1000010000/10000", + "openshift.io/sa.scc.uid-range": "1000010000/10000" + } + }, + "spec": { + "finalizers": [ + "kubernetes", + "openshift.io/origin" + ] + }, + "status": { + "phase": "Active" + } + }''' + + # Return values of our mocked function call. These get returned once per call. + mock_cmd.side_effect = [ + (0, project_results, ''), + ] + + mock_tmpfile_copy.side_effect = [ + '/tmp/mocked_kubeconfig', + ] + + mock_loc_oc_bin.side_effect = [ + 'oc', + ] + + # Act + results = OCProject.run_ansible(params, False) + + # Assert + self.assertFalse(results['changed']) + + # Making sure our mock was called as we expected + mock_cmd.assert_has_calls([ + mock.call(['oc', 'get', 'namespace', 'operations', '-o', 'json'], None), + ]) + + @mock.patch('oc_project.locate_oc_binary') + @mock.patch('oc_project.Utils.create_tmpfile_copy') + @mock.patch('oc_project.Utils._write') + @mock.patch('oc_project.OCProject._run') + def test_modifying_project_attributes(self, mock_cmd, mock_write, mock_tmpfile_copy, mock_loc_oc_bin): + ''' Testing adding a project ''' + params = copy.deepcopy(self.params) + params['display_name'] = 'updated display name' + params['node_selector'] = 'type=infra' + params['description'] = 'updated description' + + # run_ansible input parameters + project_results = '''{ + "kind": "Project", + "apiVersion": "v1", + "metadata": { + "name": "operations", + "selfLink": "/oapi/v1/projects/operations", + "uid": "5e52afb8-ee33-11e6-89f4-0edc441d9666", + "resourceVersion": "1584", + "labels": {}, + "annotations": { + "openshift.io/node-selector": "", + "openshift.io/description": "This is a description", + "openshift.io/sa.initialized-roles": "true", + "openshift.io/sa.scc.mcs": "s0:c3,c2", + "openshift.io/sa.scc.supplemental-groups": "1000010000/10000", + "openshift.io/sa.scc.uid-range": "1000010000/10000" + } + }, + "spec": { + "finalizers": [ + "kubernetes", + "openshift.io/origin" + ] + }, + "status": { + "phase": "Active" + } + }''' + + mod_project_results = '''{ + "kind": "Project", + "apiVersion": "v1", + "metadata": { + "name": "operations", + "selfLink": "/oapi/v1/projects/operations", + "uid": "5e52afb8-ee33-11e6-89f4-0edc441d9666", + "resourceVersion": "1584", + "labels": {}, + "annotations": { + "openshift.io/node-selector": "type=infra", + "openshift.io/description": "updated description", + "openshift.io/display-name": "updated display name", + "openshift.io/sa.initialized-roles": "true", + "openshift.io/sa.scc.mcs": "s0:c3,c2", + "openshift.io/sa.scc.supplemental-groups": "1000010000/10000", + "openshift.io/sa.scc.uid-range": "1000010000/10000" + } + }, + "spec": { + "finalizers": [ + "kubernetes", + "openshift.io/origin" + ] + }, + "status": { + "phase": "Active" + } + }''' + + # Return values of our mocked function call. These get returned once per call. + mock_cmd.side_effect = [ + (0, project_results, ''), + (0, project_results, ''), + (0, '', ''), + (0, mod_project_results, ''), + ] + + mock_tmpfile_copy.side_effect = [ + '/tmp/mocked_kubeconfig', + ] + + mock_loc_oc_bin.side_effect = [ + 'oc', + ] + + # Act + results = OCProject.run_ansible(params, False) + + # Assert + self.assertTrue(results['changed']) + self.assertEqual(results['results']['returncode'], 0) + self.assertEqual(results['results']['results']['metadata']['annotations']['openshift.io/description'], 'updated description') + self.assertEqual(results['state'], 'present') + + # Making sure our mock was called as we expected + mock_cmd.assert_has_calls([ + mock.call(['oc', 'get', 'namespace', 'operations', '-o', 'json'], None), + mock.call(['oc', 'get', 'namespace', 'operations', '-o', 'json'], None), + mock.call(['oc', 'replace', '-f', mock.ANY], None), + mock.call(['oc', 'get', 'namespace', 'operations', '-o', 'json'], None), + ]) diff --git a/roles/lib_openshift/src/test/unit/test_oc_route.py b/roles/lib_openshift/src/test/unit/test_oc_route.py index 09c52a461..afdb5e4dc 100755 --- a/roles/lib_openshift/src/test/unit/test_oc_route.py +++ b/roles/lib_openshift/src/test/unit/test_oc_route.py @@ -21,7 +21,7 @@ from oc_route import OCRoute, locate_oc_binary # noqa: E402 class OCRouteTest(unittest.TestCase): ''' - Test class for OCServiceAccount + Test class for OCRoute ''' @mock.patch('oc_route.locate_oc_binary') |