diff --git a/boto3/resources/collection.py b/boto3/resources/collection.py index 483c754676..73efe99fae 100644 --- a/boto3/resources/collection.py +++ b/boto3/resources/collection.py @@ -312,7 +312,7 @@ def __init__(self, model, parent, factory, resource_defs, operation_name = self._model.request.operation self._parent = parent - search_path = model.path + search_path = model.resource.path self._handler = ResourceHandler(search_path, factory, resource_defs, service_model, model.resource, operation_name) diff --git a/tests/integration/test_s3.py b/tests/integration/test_s3.py index 233ccff8b7..defb03a006 100644 --- a/tests/integration/test_s3.py +++ b/tests/integration/test_s3.py @@ -57,6 +57,9 @@ def test_s3(self): # Lazy-loaded attribute self.assertEqual(12, obj.content_length) + # Load a similar attribute from the collection response + self.assertEqual(12, list(bucket.objects.all())[0].size) + # Perform a resource action with a low-level response self.assertEqual(b'hello, world', obj.get()['Body'].read()) diff --git a/tests/unit/resources/test_model.py b/tests/unit/resources/test_model.py index f1e9a5e0e9..a936c50d8c 100644 --- a/tests/unit/resources/test_model.py +++ b/tests/unit/resources/test_model.py @@ -187,9 +187,9 @@ def test_resource_collections(self): 'operation': 'GetFrobList' }, 'resource': { - 'type': 'Frob' - }, - 'path': 'FrobList[]' + 'type': 'Frob', + 'path': 'FrobList[]' + } } } }, { @@ -202,7 +202,7 @@ def test_resource_collections(self): self.assertEqual(model.collections[0].request.operation, 'GetFrobList') self.assertEqual(model.collections[0].resource.type, 'Frob') self.assertEqual(model.collections[0].resource.model.name, 'Frob') - self.assertEqual(model.collections[0].path, 'FrobList[]') + self.assertEqual(model.collections[0].resource.path, 'FrobList[]') def test_waiter(self): model = ResourceModel('test', {