Merge "Pecan: wrap PUT response with resource name"

This commit is contained in:
Jenkins 2016-02-11 20:16:22 +00:00 committed by Gerrit Code Review
commit 105c9a7da7
2 changed files with 6 additions and 1 deletions

View File

@ -106,7 +106,7 @@ class ItemController(utils.NeutronPecanController):
# Bulk update is not supported, 'resources' always contains a single
# elemenet
data = {self.resource: resources[0]}
return updater(neutron_context, self.item, data)
return {self.resource: updater(neutron_context, self.item, data)}
@utils.when(index, method='DELETE')
def delete(self):

View File

@ -264,6 +264,11 @@ class TestResourceController(TestRootController):
params={'port': {'name': 'test'}},
headers={'X-Project-Id': 'tenid'})
self.assertEqual(response.status_int, 200)
json_body = jsonutils.loads(response.body)
self.assertEqual(1, len(json_body))
self.assertIn('port', json_body)
self.assertEqual('test', json_body['port']['name'])
self.assertEqual('tenid', json_body['port']['tenant_id'])
def test_delete(self):
response = self.app.delete('/v2.0/ports/%s.json' % self.port['id'],