def test_heartbeat(self, mCreateSession): iSession = MockSession() client = iSession.client('stepfunctions') mCreateSession.return_value = (iSession, '123456') task = TaskMixin() task.token = 'token' task.heartbeat() call = mock.call.send_task_heartbeat(taskToken='token') self.assertEqual(client.mock_calls, [call])
def test_failure_timeout(self, mCreateSession): iSession = MockSession() mCreateSession.return_value = (iSession, '123456') client = iSession.client('stepfunctions') client.send_task_failure.side_effect = TimeoutError() task = TaskMixin() task.token = 'token' task.failure(None, None) self.assertEqual(task.token, None)
def test_success(self, mCreateSession): iSession = MockSession() client = iSession.client('stepfunctions') mCreateSession.return_value = (iSession, '123456') task = TaskMixin() task.token = 'token' self.assertEqual(task.token, 'token') task.success(None) self.assertEqual(task.token, None) call = mock.call.send_task_success(taskToken='token', output='null') self.assertEqual(client.mock_calls, [call])
def test_failure(self, mCreateSession): iSession = MockSession() client = iSession.client('stepfunctions') mCreateSession.return_value = (iSession, '123456') task = TaskMixin() task.token = 'token' self.assertEqual(task.token, 'token') task.failure(None, None) self.assertEqual(task.token, None) call = mock.call.send_task_failure(taskToken='token', error=None, cause=None) self.assertEqual(client.mock_calls, [call])