Skip to content

Commit

Permalink
Merge pull request #61 from boto/collection-path-fix
Browse files Browse the repository at this point in the history
Fix collection resource hydration path.
  • Loading branch information
danielgtaylor committed Feb 10, 2015
2 parents d4ce4f9 + f4a2e72 commit 28ae6a8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion boto3/resources/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 3 additions & 0 deletions tests/integration/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/resources/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ def test_resource_collections(self):
'operation': 'GetFrobList'
},
'resource': {
'type': 'Frob'
},
'path': 'FrobList[]'
'type': 'Frob',
'path': 'FrobList[]'
}
}
}
}, {
Expand All @@ -211,7 +211,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', {
Expand Down

0 comments on commit 28ae6a8

Please sign in to comment.