diff options
Diffstat (limited to 'roles/lib_openshift/src')
-rw-r--r-- | roles/lib_openshift/src/class/oc_project.py | 4 | ||||
-rwxr-xr-x | roles/lib_openshift/src/test/unit/test_oc_project.py | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/roles/lib_openshift/src/class/oc_project.py b/roles/lib_openshift/src/class/oc_project.py index 5b39b43fa..7e3984297 100644 --- a/roles/lib_openshift/src/class/oc_project.py +++ b/roles/lib_openshift/src/class/oc_project.py @@ -70,7 +70,7 @@ class OCProject(OpenShiftCLI): else: self.project.update_annotation('node-selector', self.project.find_annotation('node-selector')) - return self._replace_content(self.kind, self.config.namespace, self.project.yaml_dict) + return self._replace_content(self.kind, self.config.name, self.project.yaml_dict) def needs_update(self): ''' verify an update is needed ''' @@ -98,7 +98,7 @@ class OCProject(OpenShiftCLI): _ns = ','.join(params['node_selector']) pconfig = ProjectConfig(params['name'], - None, + 'None', params['kubeconfig'], {'admin': {'value': params['admin'], 'include': True}, 'admin_role': {'value': params['admin_role'], 'include': True}, 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 3cc439bf7..1f9d353aa 100755 --- a/roles/lib_openshift/src/test/unit/test_oc_project.py +++ b/roles/lib_openshift/src/test/unit/test_oc_project.py @@ -35,10 +35,11 @@ class OCProjectTest(unittest.TestCase): ''' setup method will create a file and set to known configuration ''' pass + @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_adding_a_project(self, mock_cmd, mock_write, mock_tmpfile_copy): + def test_adding_a_project(self, mock_cmd, mock_write, mock_tmpfile_copy, mock_loc_oc_bin): ''' Testing adding a project ''' # Arrange @@ -96,6 +97,10 @@ class OCProjectTest(unittest.TestCase): '/tmp/mocked_kubeconfig', ] + mock_loc_oc_bin.side_effect = [ + 'oc', + ] + # Act results = OCProject.run_ansible(params, False) |