diff options
author | 2022-02-14 19:43:35 +0000 | |
---|---|---|
committer | 2022-02-15 19:07:55 +0000 | |
commit | b755a690a44cc5ebb066701f710f161ee6ce3070 (patch) | |
tree | d140cffe4a6f96b705988a92d96148109294bf5d /components/pm-subscription-handler/tests | |
parent | 2a21c78886d13c4266da639252d8fb899b7d34a5 (diff) |
[PMSH] Exit Handler Update
Issue-ID: DCAEGEN2-3084
Signed-off-by: Raviteja, Karumuri <raviteja.karumuri@est.tech>
Change-Id: Iecda19e7dbac2c612ec72a1ec34f72fdd7ba143b
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) |