Esempio n. 1
0
    def test_delete_activity(self, mCreateSession):
        iSession = MockSession()
        mCreateSession.return_value = (iSession, '123456')
        client = iSession.client('stepfunctions')

        activity = ActivityMixin()
        activity.arn = 'XXX'

        activity.delete_activity()

        self.assertEqual(activity.arn, None)

        calls = [mock.call.delete_activity(activityArn='XXX')]
        self.assertEqual(client.mock_calls, calls)
Esempio n. 2
0
    def test_create_activity_exists(self, mCreateSession):
        iSession = MockSession()
        mCreateSession.return_value = (iSession, '123456')
        client = iSession.client('stepfunctions')

        activity = ActivityMixin()
        activity.arn = 'XXX'

        activity.create_activity()

        self.assertEqual(activity.arn, 'XXX')

        calls = []
        self.assertEqual(client.mock_calls, calls)
Esempio n. 3
0
    def test_poll_task_no_work(self, mCreateSession):
        iSession = MockSession()
        mCreateSession.return_value = (iSession, '123456')
        client = iSession.client('stepfunctions')
        client.get_activity_task.return_value = {'taskToken': ''}

        activity = ActivityMixin()
        activity.arn = 'XXX'

        token, input_ = activity.poll_task('worker')

        self.assertEqual(token, None)
        self.assertEqual(input_, None)

        calls = [
            mock.call.get_activity_task(activityArn='XXX', workerName='worker')
        ]
        self.assertEqual(client.mock_calls, calls)