Пример #1
0
    def test_receive_identities_from_queue_single(self, session_mock):

        sqs_client_mock = Mock()
        sqs_client_mock.receive_message.return_value = {
            'Messages': [
                {
                    'MessageId': '123',
                    'ReceiptHandle': 'handle123',
                    'MD5OfBody': 'md5123',
                    'Body':
                    json.dumps(TEST_IDENTITY_1_A_US_WEST_2['identity']),
                    'MD5OfMessageAttributes': 'string',
                    'Attributes': {
                        'SentTimestamp': '123123123'
                    }
                },
            ]
        }

        testSkunky = Skunky(session_mock)
        testSkunky.sqs_client = sqs_client_mock

        testSkunky.receive_identities_from_queue()

        assert len(testSkunky.to_be_skunked['000000000001']['us-west-2']) == 1
Пример #2
0
    def test_get_queue_url(self, session_mock):

        sqs_client_mock = Mock()
        sqs_client_mock.get_queue_url.return_value = {
            'QueueUrl': 'https://queue.amazonaws.com/123456789101112/MyQueue',
            'ResponseMetadata': {},
        }

        testSkunky = Skunky(session_mock)
        testSkunky.sqs_client = sqs_client_mock

        assert testSkunky.get_queue_url(
        ) == 'https://queue.amazonaws.com/123456789101112/MyQueue'