From 7454db5d4c52832c964531309de8ff87589b5fc7 Mon Sep 17 00:00:00 2001 From: zhufl Date: Wed, 27 May 2020 13:49:20 +0800 Subject: [PATCH] Add response schema validation for show_default_group_type This is to add response schema validation for show_default_group_type. Change-Id: Iaed564689588b1a4fe0a9118e9de330ec0a63e61 partially-implements: blueprint volume-response-schema-validation --- .../lib/api_schema/response/volume/group_types.py | 12 ++++++++++++ tempest/lib/services/volume/v3/group_types_client.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tempest/lib/api_schema/response/volume/group_types.py b/tempest/lib/api_schema/response/volume/group_types.py index bcfa32eb0c..4fc9ae85dc 100644 --- a/tempest/lib/api_schema/response/volume/group_types.py +++ b/tempest/lib/api_schema/response/volume/group_types.py @@ -73,6 +73,18 @@ show_group_type = { } } +show_default_group_type = { + 'status_code': [200], + 'response_body': { + 'type': 'object', + 'properties': { + 'group_type': common_show_group_type + }, + 'additionalProperties': False, + 'required': ['group_type'] + } +} + update_group_type = { 'status_code': [200], 'response_body': { diff --git a/tempest/lib/services/volume/v3/group_types_client.py b/tempest/lib/services/volume/v3/group_types_client.py index e0bf5e2ae6..1dcd508ee9 100644 --- a/tempest/lib/services/volume/v3/group_types_client.py +++ b/tempest/lib/services/volume/v3/group_types_client.py @@ -73,7 +73,7 @@ class GroupTypesClient(base_client.BaseClient): url = 'group_types/default' resp, body = self.get(url) body = json.loads(body) - self.expected_success(200, resp.status) + self.validate_response(schema.show_default_group_type, resp, body) return rest_client.ResponseBody(resp, body) def show_group_type(self, group_type_id):