Miss 'next' field at list response

Change-Id: Id8510fa66e2407404e82cac73fa9843ba067eee5
Closes-Bug: #1681537
This commit is contained in:
Feng Shengqin 2017-04-11 17:04:23 +08:00
parent 93c9b81566
commit b47890589e
5 changed files with 13 additions and 17 deletions

View File

@ -14,17 +14,10 @@ import pecan
from zun.api.controllers import base
from zun.api.controllers import link
from zun.api.controllers import types
class Collection(base.APIBase):
fields = {
'next': {
'validate': types.Text.validate,
},
}
@property
def collection(self):
return getattr(self, self._type)

View File

@ -57,7 +57,8 @@ class ContainerCollection(collection.Collection):
"""API representation of a collection of containers."""
fields = {
'containers'
'containers',
'next'
}
"""A list containing containers objects"""

View File

@ -33,7 +33,8 @@ class ImageCollection(collection.Collection):
"""API representation of a collection of images."""
fields = {
'images'
'images',
'next'
}
"""A list containing images objects"""

View File

@ -23,7 +23,8 @@ from zun import objects
class ZunServiceCollection(collection.Collection):
fields = {
'services'
'services',
'next'
}
def __init__(self, **kwargs):

View File

@ -175,7 +175,7 @@ class TestContainerController(api_base.FunctionalTest):
mock_container_show.return_value = container
response = self.app.get('/v1/containers/')
self.assertEqual(200, response.status_int)
self.assertEqual(1, len(response.json))
self.assertEqual(2, len(response.json))
c = response.json['containers'][0]
self.assertIsNotNone(c.get('uuid'))
self.assertEqual('MyDocker', c.get('name'))
@ -216,7 +216,7 @@ class TestContainerController(api_base.FunctionalTest):
mock_container_show.return_value = container
response = self.app.get('/v1/containers/')
self.assertEqual(200, response.status_int)
self.assertEqual(1, len(response.json))
self.assertEqual(2, len(response.json))
c = response.json['containers'][0]
self.assertIsNotNone(c.get('uuid'))
self.assertEqual('MyDocker', c.get('name'))
@ -246,7 +246,7 @@ class TestContainerController(api_base.FunctionalTest):
mock_container_show.return_value = container
response = self.app.get('/v1/containers/')
self.assertEqual(200, response.status_int)
self.assertEqual(1, len(response.json))
self.assertEqual(2, len(response.json))
c = response.json['containers'][0]
self.assertIsNotNone(c.get('uuid'))
self.assertEqual('MyDocker', c.get('name'))
@ -275,7 +275,7 @@ class TestContainerController(api_base.FunctionalTest):
mock_container_show.return_value = container
response = self.app.get('/v1/containers/')
self.assertEqual(200, response.status_int)
self.assertEqual(1, len(response.json))
self.assertEqual(2, len(response.json))
c = response.json['containers'][0]
self.assertIsNotNone(c.get('uuid'))
self.assertIsNotNone(c.get('name'))
@ -309,7 +309,7 @@ class TestContainerController(api_base.FunctionalTest):
mock_container_show.return_value = container
response = self.app.get('/v1/containers/')
self.assertEqual(200, response.status_int)
self.assertEqual(1, len(response.json))
self.assertEqual(2, len(response.json))
c = response.json['containers'][0]
self.assertIsNotNone(c.get('uuid'))
self.assertEqual('MyDocker', c.get('name'))
@ -343,7 +343,7 @@ class TestContainerController(api_base.FunctionalTest):
mock_container_show.return_value = container
response = self.app.get('/v1/containers/')
self.assertEqual(200, response.status_int)
self.assertEqual(1, len(response.json))
self.assertEqual(2, len(response.json))
c = response.json['containers'][0]
self.assertIsNotNone(c.get('uuid'))
self.assertEqual('MyDocker', c.get('name'))
@ -377,7 +377,7 @@ class TestContainerController(api_base.FunctionalTest):
mock_container_show.return_value = container
response = self.app.get('/v1/containers/')
self.assertEqual(200, response.status_int)
self.assertEqual(1, len(response.json))
self.assertEqual(2, len(response.json))
c = response.json['containers'][0]
self.assertIsNotNone(c.get('uuid'))
self.assertEqual('MyDocker', c.get('name'))