def test_get_task_id(self): action = Action() action.task.clear() self.assertEqual('task_1', action.get_task_id()) task_data = dict(cmd='reverse', string='test123') action.add_task(task_data) self.assertEqual('task_2', action.get_task_id()) action.task.clear()
def test_add_task(self): action = Action() queue.Queue.put = Mock() task_data = dict(cmd='reverse', string='test123') task_id = action.add_task(task_data) self.assertEqual(1, len(action.task)) self.assertEqual('task_1', task_id) action.queue.put.assert_called_once_with(task_data) print(action.task)