

def test_subresource_requires_only_identifier(self):
    defs = {
        'Queue': {
            'identifiers': [{
                'name': 'Url',
            }],
            'has': {
                'Message': {
                    'resource': {
                        'type': 'Message',
                        'identifiers': [{
                            'target': 'QueueUrl',
                            'source': 'identifier',
                            'name': 'Url',
                        }, {
                            'target': 'ReceiptHandle',
                            'source': 'input',
                        }],
                    },
                },
            },
        },
        'Message': {
            'identifiers': [{
                'name': 'QueueUrl',
            }, {
                'name': 'ReceiptHandle',
            }],
        },
    }
    model = defs['Queue']
    queue = self.load('Queue', model, defs)('url')
    message = queue.Message('receipt')
    self.assertEqual(message.queue_url, 'url', 'Wrong queue URL set on the message resource instance')
    self.assertEqual(message.receipt_handle, 'receipt', 'Wrong receipt handle set on the message resource instance')

dataset/ETHPy150Open boto/boto3/tests/unit/resources/test_factory.py TestResourceFactory.test_subresource_requires_only_identifier/original