diff options
author | raviteja.karumuri <raviteja.karumuri@est.tech> | 2022-03-02 17:59:27 +0000 |
---|---|---|
committer | raviteja.karumuri <raviteja.karumuri@est.tech> | 2022-03-03 16:54:04 +0000 |
commit | 5a2c43f2add2c6d4af8331a40b174684eac11b34 (patch) | |
tree | 4e76bac8e33d80b1e0e9af1fdf2b57fe6a9a7bf2 /components/pm-subscription-handler/tests/test_exit_handler.py | |
parent | 5f69c24ad78121a2840b5299583791e557f8b535 (diff) |
[PMSH] Cleaning up old App Config, subscription handler and it's subsequent calls
Issue-ID: DCAEGEN2-3085
Signed-off-by: Raviteja, Karumuri <raviteja.karumuri@est.tech>
Change-Id: I7b862648eebf59844aaa9d09697b7f2a693c9d94
Diffstat (limited to 'components/pm-subscription-handler/tests/test_exit_handler.py')
-rwxr-xr-x | components/pm-subscription-handler/tests/test_exit_handler.py | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/components/pm-subscription-handler/tests/test_exit_handler.py b/components/pm-subscription-handler/tests/test_exit_handler.py index c98be634..d88b4752 100755 --- a/components/pm-subscription-handler/tests/test_exit_handler.py +++ b/components/pm-subscription-handler/tests/test_exit_handler.py @@ -17,32 +17,31 @@ # ============LICENSE_END===================================================== import os from signal import SIGTERM, signal -from unittest.mock import patch +from unittest.mock import patch, MagicMock +from mod import db from mod.exit_handler import ExitHandler -from tests.base_setup import BaseClassSetup +from tests.base_setup import BaseClassSetup, create_subscription_data class ExitHandlerTests(BaseClassSetup): - @classmethod - def setUpClass(cls): - super().setUpClass() - - @patch('mod.pmsh_utils.PeriodicTask') - @patch('mod.pmsh_utils.PeriodicTask') + @patch('pmsh_service_main.PeriodicTask') + @patch('pmsh_service_main.PeriodicTask') def setUp(self, mock_periodic_task_aai, mock_periodic_task_policy): super().setUp() + subscription = create_subscription_data('aai_event_handler') + subscription.measurement_groups[1].administravtive_sate = 'UNLOCKED' + db.session.add(subscription) + db.session.add(subscription.measurement_groups[0]) + db.session.add(subscription.measurement_groups[1]) + db.session.add(subscription.network_filter) + db.session.add(subscription.nfs[0]) + db.session.commit() self.mock_aai_event_thread = mock_periodic_task_aai self.mock_policy_resp_handler_thread = mock_periodic_task_policy - def tearDown(self): - super().tearDown() - - @classmethod - def tearDownClass(cls): - super().tearDownClass() - + @patch('mod.pmsh_config.AppConfig.publish_to_topic', MagicMock(return_value=None)) def test_terminate_signal_successful(self): handler = ExitHandler(periodic_tasks=[self.mock_aai_event_thread, self.mock_policy_resp_handler_thread]) |