Add missing schema for update agent API

There is missing response schema for update Agent API.

This commit adds the same and also correcting the unit test for
update agent.

Change-Id: I68a5f038d58c1fd1026475516c34aa5d0d82b74f
This commit is contained in:
ghanshyam 2015-09-18 10:21:28 +09:00
parent 307df12b98
commit e453fe5cca
3 changed files with 23 additions and 3 deletions

View File

@ -55,6 +55,28 @@ create_agent = {
}
}
update_agent = {
'status_code': [200],
'response_body': {
'type': 'object',
'properties': {
'agent': {
'type': 'object',
'properties': {
'agent_id': {'type': ['integer', 'string']},
'version': {'type': 'string'},
'url': {'type': 'string', 'format': 'uri'},
'md5hash': {'type': 'string'}
},
'additionalProperties': False,
'required': ['agent_id', 'version', 'url', 'md5hash']
}
},
'additionalProperties': False,
'required': ['agent']
}
}
delete_agent = {
'status_code': [200]
}

View File

@ -51,4 +51,5 @@ class AgentsClient(rest_client.RestClient):
put_body = json.dumps({'para': kwargs})
resp, body = self.put('os-agents/%s' % agent_id, put_body)
body = json.loads(body)
self.validate_response(schema.update_agent, resp, body)
return rest_client.ResponseBody(resp, body)

View File

@ -33,11 +33,8 @@ class TestAgentsClient(base.BaseComputeServiceTest):
FAKE_UPDATE_AGENT = {
"agent": {
"url": "http://foo.com",
"hypervisor": "kvm",
"md5hash": "md5",
"version": "2",
"architecture": "x86_64",
"os": "linux",
"agent_id": 1
}
}