def test__start_get_updates_loop_start_thread_correctly(self, mock_thread): dummy_thread = MagicMock() mock_thread.return_value = dummy_thread tcb = TelegramController() tcb._handle_message = MagicMock() tcb.terminating = True # for Test tcb._start_get_updates_loop() dummy_thread.start.assert_called() self.assertEqual(mock_thread.call_args[1]["name"], "get updates") self.assertEqual(mock_thread.call_args[1]["daemon"], True)
def test_main_should_call__start_get_updates_loop(self): tcb = TelegramController() tcb.terminating = True # for Test tcb._start_get_updates_loop = MagicMock() tcb.main() tcb._start_get_updates_loop.assert_called_once()