Pecan: wrap PUT response with resource name

For no peculiar reason other than that's the way the API is
supposed to work.

Change-Id: Ifd6f8b492dfc86c069a4f33931235c7f3d8e7c2e
Closes-Bug: #1537929
This commit is contained in:
Salvatore Orlando
2016-01-25 15:01:34 -08:00
parent cf8f60e5f3
commit 7c24fa111e
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'],