diff --git a/heat/tests/test_engine_service.py b/heat/tests/test_engine_service.py index dd8bbe9280..500eb7cb42 100644 --- a/heat/tests/test_engine_service.py +++ b/heat/tests/test_engine_service.py @@ -2987,12 +2987,10 @@ class ThreadGroupManagerTest(HeatTestCase): self.stlock_mock.StackLock.assert_called_with(self.cnxt, self.stack, self.engine_id) - self.lock_mock.acquire.assert_called_once() - thm.start_with_acquired_lock.assert_called_once() - calls = thm.start_with_acquired_lock.call_args - self.assertEqual((self.stack, self.lock_mock, self.f) + self.fargs, - calls[0]) - self.assertEqual(self.fkwargs, calls[1]) + + thm.start_with_acquired_lock.assert_called_once_with( + self.stack, self.lock_mock, + self.f, *self.fargs, **self.fkwargs) def test_tgm_start(self): stack_id = 'test' diff --git a/heat/tests/test_stack_lock.py b/heat/tests/test_stack_lock.py index a5069bf51d..c497508666 100644 --- a/heat/tests/test_stack_lock.py +++ b/heat/tests/test_stack_lock.py @@ -170,17 +170,17 @@ class StackLockTest(HeatTestCase): slock = stack_lock.StackLock(self.context, self.stack, self.engine_id) try: with slock.thread_lock(self.stack.id): - db_api.stack_lock_create.assert_called_once() + self.assertEqual(1, db_api.stack_lock_create.call_count) raise Exception except: - db_api.stack_lock_release.assert_called_once() + self.assertEqual(1, db_api.stack_lock_release.call_count) def test_thread_lock_context_mgr_no_exception(self): db_api.stack_lock_create = mock.Mock(return_value=None) db_api.stack_lock_release = mock.Mock(return_value=None) slock = stack_lock.StackLock(self.context, self.stack, self.engine_id) with slock.thread_lock(self.stack.id): - db_api.stack_lock_create.assert_called_once() + self.assertEqual(1, db_api.stack_lock_create.call_count) assert not db_api.stack_lock_release.called def test_try_thread_lock_context_mgr_exception(self): @@ -189,17 +189,17 @@ class StackLockTest(HeatTestCase): slock = stack_lock.StackLock(self.context, self.stack, self.engine_id) try: with slock.try_thread_lock(self.stack.id): - db_api.stack_lock_create.assert_called_once() + self.assertEqual(1, db_api.stack_lock_create.call_count) raise Exception except: - db_api.stack_lock_release.assert_called_once() + self.assertEqual(1, db_api.stack_lock_release.call_count) def test_try_thread_lock_context_mgr_no_exception(self): db_api.stack_lock_create = mock.Mock(return_value=None) db_api.stack_lock_release = mock.Mock(return_value=None) slock = stack_lock.StackLock(self.context, self.stack, self.engine_id) with slock.try_thread_lock(self.stack.id): - db_api.stack_lock_create.assert_called_once() + self.assertEqual(1, db_api.stack_lock_create.call_count) assert not db_api.stack_lock_release.called def test_try_thread_lock_context_mgr_existing_lock(self): @@ -208,7 +208,7 @@ class StackLockTest(HeatTestCase): slock = stack_lock.StackLock(self.context, self.stack, self.engine_id) try: with slock.try_thread_lock(self.stack.id): - db_api.stack_lock_create.assert_called_once() + self.assertEqual(1, db_api.stack_lock_create.call_count) raise Exception except: assert not db_api.stack_lock_release.called