diff options
author | Tony Hansen <tony@att.com> | 2022-02-16 14:33:56 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-02-16 14:33:56 +0000 |
commit | 28b3d8f7ac48cb202b04d599b52112282a38417e (patch) | |
tree | 835d5d6d3e0dfb8b5b9e9e2a89b3ae179dabf2a9 /components/pm-subscription-handler/tests | |
parent | 3b4a84291c1f251b692176233cb819bf308fef94 (diff) | |
parent | b755a690a44cc5ebb066701f710f161ee6ce3070 (diff) |
Merge "[PMSH] Exit Handler Update"
Diffstat (limited to 'components/pm-subscription-handler/tests')
-rwxr-xr-x | components/pm-subscription-handler/tests/test_exit_handler.py | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/components/pm-subscription-handler/tests/test_exit_handler.py b/components/pm-subscription-handler/tests/test_exit_handler.py index c3cc0241..c98be634 100755 --- a/components/pm-subscription-handler/tests/test_exit_handler.py +++ b/components/pm-subscription-handler/tests/test_exit_handler.py @@ -1,5 +1,5 @@ # ============LICENSE_START=================================================== -# Copyright (C) 2020 Nordix Foundation. +# Copyright (C) 2020-2022 Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,10 +17,9 @@ # ============LICENSE_END===================================================== import os from signal import SIGTERM, signal -from unittest.mock import patch, Mock +from unittest.mock import patch from mod.exit_handler import ExitHandler -from mod.subscription import Subscription from tests.base_setup import BaseClassSetup @@ -31,10 +30,11 @@ class ExitHandlerTests(BaseClassSetup): super().setUpClass() @patch('mod.pmsh_utils.PeriodicTask') - def setUp(self, mock_periodic_task): + @patch('mod.pmsh_utils.PeriodicTask') + def setUp(self, mock_periodic_task_aai, mock_periodic_task_policy): super().setUp() - self.mock_aai_event_thread = mock_periodic_task - self.sub = self.app_conf.subscription + self.mock_aai_event_thread = mock_periodic_task_aai + self.mock_policy_resp_handler_thread = mock_periodic_task_policy def tearDown(self): super().tearDown() @@ -43,13 +43,9 @@ class ExitHandlerTests(BaseClassSetup): def tearDownClass(cls): super().tearDownClass() - @patch.object(Subscription, 'update_sub_nf_status') - @patch.object(Subscription, 'update_subscription_status') - def test_terminate_signal_successful(self, mock_upd_sub_status, - mock_upd_subnf_status): - handler = ExitHandler(periodic_tasks=[self.mock_aai_event_thread], - app_conf=self.app_conf, - subscription_handler=Mock()) + def test_terminate_signal_successful(self): + handler = ExitHandler(periodic_tasks=[self.mock_aai_event_thread, + self.mock_policy_resp_handler_thread]) signal(SIGTERM, handler) os.kill(os.getpid(), SIGTERM) self.assertTrue(ExitHandler.shutdown_signal_received) |