Merge "Fix version response from root controller"

This commit is contained in:
Jenkins 2016-12-30 11:04:51 +00:00 committed by Gerrit Code Review
commit bf2d3061da
3 changed files with 8 additions and 6 deletions

View File

@ -149,8 +149,9 @@ class Link(Resource):
href = wtypes.text
target = wtypes.text
rel = wtypes.text
@classmethod
def sample(cls):
return cls(href='http://example.com/here',
target='here')
target='here', rel='self')

View File

@ -45,7 +45,7 @@ class APIVersion(resource.Resource):
id='v1.0',
status='CURRENT',
links=[
resource.Link(target_name='v1',
resource.Link(target_name='v1', rel="self",
href='http://example.com:9777/v1')
]
)
@ -57,7 +57,7 @@ class APIVersions(resource.Resource):
@classmethod
def sample(cls):
v2 = APIVersion(id='v2.0', status='CURRENT',
v2 = APIVersion(id='v2.0', status='CURRENT', rel="self",
href='http://example.com:9777/v2')
return cls(versions=[v2])
@ -73,7 +73,8 @@ class RootController(object):
api_v2 = APIVersion(
id='v2.0',
status='CURRENT',
links=[resource.Link(href=host_url_v2, target='v2')]
links=[resource.Link(href=host_url_v2, target='v2',
rel="self",)]
)
return APIVersions(versions=[api_v2])

View File

@ -30,7 +30,7 @@ class TestRootController(base.APITest):
self.assertEqual('v2.0', data[0]['id'])
self.assertEqual('CURRENT', data[0]['status'])
self.assertEqual(
[{'href': 'http://localhost/v2', 'target': 'v2'}],
[{'href': 'http://localhost/v2', 'rel': 'self', 'target': 'v2'}],
data[0]['links']
)
@ -58,7 +58,7 @@ class TestRootControllerWithAuth(test_auth.TestKeystoneMiddleware):
self.assertEqual('v2.0', data[0]['id'])
self.assertEqual('CURRENT', data[0]['status'])
self.assertEqual(
[{'href': 'http://localhost/v2', 'target': 'v2'}],
[{'href': 'http://localhost/v2', 'rel': 'self', 'target': 'v2'}],
data[0]['links']
)