Check list servers attributes of Nova APIs
This patch adds the JSON schema for Nova V2 & V3 list servers
APIs response and validate the response with added JSON schema
to block the backward incompatibility change in the future.
Response status of list servers V2 & V3 APIs is same and given below-
{
"servers": [
{
"id": "22c91117-08de-4894-9aa9-6ef382400985",
"links": [
{
"href": "http://openstack.example.com/v3/servers/
22c91117-08de-4894-9aa9-6ef382400985",
"rel": "self"
},
{
"href": "http://openstack.example.com/servers/
22c91117-08de-4894-9aa9-6ef382400985",
"rel": "bookmark"
}
],
"name": "new-server-test"
}
]
}
Partially implements blueprint nova-api-attribute-test
Change-Id: I5e3854011f00b468dc63eddafd7e76a9048b1997
This commit is contained in:
@@ -117,3 +117,25 @@ list_server_metadata = copy.deepcopy(set_server_metadata)
|
||||
delete_server_metadata_item = {
|
||||
'status_code': [204]
|
||||
}
|
||||
|
||||
list_servers = {
|
||||
'status_code': [200],
|
||||
'response_body': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'servers': {
|
||||
'type': 'array',
|
||||
'items': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'id': {'type': 'string'},
|
||||
'links': parameter_types.links,
|
||||
'name': {'type': 'string'}
|
||||
},
|
||||
'required': ['id', 'links', 'name']
|
||||
}
|
||||
}
|
||||
},
|
||||
'required': ['servers']
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,6 +150,7 @@ class ServersClientJSON(rest_client.RestClient):
|
||||
|
||||
resp, body = self.get(url)
|
||||
body = json.loads(body)
|
||||
self.validate_response(common_schema.list_servers, resp, body)
|
||||
return resp, body
|
||||
|
||||
def list_servers_with_detail(self, params=None):
|
||||
|
||||
@@ -150,6 +150,7 @@ class ServersV3ClientJSON(rest_client.RestClient):
|
||||
|
||||
resp, body = self.get(url)
|
||||
body = json.loads(body)
|
||||
self.validate_response(common_schema.list_servers, resp, body)
|
||||
return resp, body
|
||||
|
||||
def list_servers_with_detail(self, params=None):
|
||||
|
||||
Reference in New Issue
Block a user