예제 #1
0
 def _put_mock_tables(self):
     # Build a new dynamodb schema matching the tables configured
     put_mock_dynamod_data(
         'table_name', {
             'AttributeDefinitions': [{
                 'AttributeName': 'MyPartitionKey',
                 'AttributeType': 'S'
             }, {
                 'AttributeName': 'MySortKey',
                 'AttributeType': 'S'
             }],
             'KeySchema': [{
                 'AttributeName': 'MyPartitionKey',
                 'KeyType': 'HASH'
             }, {
                 'AttributeName': 'MySortKey',
                 'KeyType': 'RANGE'
             }]
         }, [{
             'MyPartitionKey': 'aaaa',
             'MySortKey': '1',
             'MyValueKey': 'could_this_be_a_foo?',
         }, {
             'MyPartitionKey': 'aaaa',
             'MySortKey': '2',
             'MyValueKey': 'or_is_this_just_fantasy?',
         }, {
             'MyPartitionKey': 'aaaa',
             'MySortKey': '3',
             'MyValueKey': 'no_couldnt_be',
         }, {
             'MyPartitionKey': 'bbbb',
             'MySortKey': '1',
             'MyValueKey': 'beeffedfeedbeefdeaddeafbeddab',
         }])
예제 #2
0
    def _put_mock_data(self):
        # S3 mock data
        put_mock_s3_object('bucket_name', 'foo.json', json.dumps({
            'key_1': 'foo_1',
            'key_2': 'foo_2',
        }))
        put_mock_s3_object(
            'bucket_name', 'bar.json',
            zlib.compress(json.dumps({
                'key_1': 'compressed_bar_1',
                'key_2': 'compressed_bar_2',
            }).encode())
        )

        # DynamoDB Mock data
        # Build a new dynamodb schema matching the tables configured
        put_mock_dynamod_data(
            'table_name',
            {
                'AttributeDefinitions': [
                    {
                        'AttributeName': 'MyPartitionKey',
                        'AttributeType': 'S'
                    },
                    {
                        'AttributeName': 'MySortKey',
                        'AttributeType': 'S'
                    }
                ],
                'KeySchema': [
                    {
                        'AttributeName': 'MyPartitionKey',
                        'KeyType': 'HASH'
                    },
                    {
                        'AttributeName': 'MySortKey',
                        'KeyType': 'RANGE'
                    }
                ],
            },
            [
                {
                    'MyPartitionKey': 'aaaa',
                    'MySortKey': '1',
                    'MyValueKey': 'Over 9000!',
                }
            ]
        )
예제 #3
0
 def _put_mock_tables(self):
     # Build a new dynamodb schema matching the tables configured
     put_mock_dynamod_data(
         'multi_table', {
             'AttributeDefinitions': [{
                 'AttributeName': 'Pkey',
                 'AttributeType': 'S'
             }],
             'KeySchema': [{
                 'AttributeName': 'Pkey',
                 'KeyType': 'HASH'
             }],
         }, [{
             'Pkey': 'aaaa-bbbb-cccc',
             'IntegerField': 123,
             'StringField': 'hello world!',
             'DictField': {
                 'message': {
                     'depth': 'Will this work?'
                 }
             }
         }])