From dfa2ee92d5ae7e58e2b38c6a947ee6b55be2637a Mon Sep 17 00:00:00 2001 From: Yu Ming Zhu Date: Mar 10 2021 11:44:00 +0000 Subject: fix unittests for missing koji profile --- diff --git a/tests/test_add_module.py b/tests/test_add_module.py index 96d22a4..f822b42 100644 --- a/tests/test_add_module.py +++ b/tests/test_add_module.py @@ -51,6 +51,9 @@ class TestAddModuleHandler(unittest.TestCase): self.set_args() + self.koji_get_profile_module_patcher = patch('koji.get_profile_module') + self.koji_get_profile_module = self.koji_get_profile_module_patcher.start() + self.koji_session_patcher = patch('koji.ClientSession') self.mock_koji_session = self.koji_session_patcher.start().return_value @@ -61,6 +64,7 @@ class TestAddModuleHandler(unittest.TestCase): def tearDown(self): self.koji_session_patcher.stop() self.request_get_patcher.stop() + self.koji_get_profile_module_patcher.stop() try: shutil.rmtree(self.tmpdir) except: # noqa diff --git a/tests/test_check_config.py b/tests/test_check_config.py index 699d727..2adc6b2 100644 --- a/tests/test_check_config.py +++ b/tests/test_check_config.py @@ -41,11 +41,16 @@ class TestCheckConfig: self.mock_ClientSession = self.ClientSession_patcher.start() self.koji_session = self.mock_ClientSession.return_value + self.koji_get_profile_module_patcher = patch('koji.get_profile_module') + self.koji_get_profile_module = self.koji_get_profile_module_patcher.start() + self.get_patcher = patch('requests.get') self.mock_get = self.get_patcher.start() def teardown_method(self, method): self.get_patcher.stop() + self.ClientSession_patcher.stop() + self.koji_get_profile_module_patcher.stop() os.unlink(self.tag_config_file) def write_tag_config_file(self, content): diff --git a/tests/test_remove_module.py b/tests/test_remove_module.py index 088120b..72adf57 100644 --- a/tests/test_remove_module.py +++ b/tests/test_remove_module.py @@ -52,6 +52,9 @@ class TestRemoveModuleHandler(unittest.TestCase): self.set_args() + self.koji_get_profile_module_patcher = patch('koji.get_profile_module') + self.koji_get_profile_module = self.koji_get_profile_module_patcher.start() + self.koji_session_patcher = patch('koji.ClientSession') self.mock_koji_session = self.koji_session_patcher.start().return_value @@ -62,6 +65,7 @@ class TestRemoveModuleHandler(unittest.TestCase): def tearDown(self): self.koji_session_patcher.stop() self.request_get_patcher.stop() + self.koji_get_profile_module_patcher.stop() try: shutil.rmtree(self.tmpdir) except: # noqa