Пример #1
0
    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])
Пример #2
0
    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)
Пример #3
0
    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])
Пример #4
0
    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])