Rearrange certificates response schema into one file
After removing v3 schemas, we have only 1 set of schemas for v2 (/v2.1)
APIs but those end up in scattered structure.
Schema files needs to be re arranged into a clean structure. Any
resource schema should be defined in single file for better readability.
This patch merge the certificates response schema into one file.
Partially implements blueprint rearrange-nova-response-schemas
Change-Id: I50752ca74f08029c16913bea98361d84d04aa90c
diff --git a/tempest/api_schema/response/compute/certificates.py b/tempest/api_schema/response/compute/certificates.py
deleted file mode 100644
index caac2ab..0000000
--- a/tempest/api_schema/response/compute/certificates.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright 2014 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import copy
-
-_common_schema = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'certificate': {
- 'type': 'object',
- 'properties': {
- 'data': {'type': 'string'},
- 'private_key': {'type': 'string'},
- },
- 'required': ['data', 'private_key'],
- }
- },
- 'required': ['certificate'],
- }
-}
-
-get_certificate = copy.deepcopy(_common_schema)
-get_certificate['response_body']['properties']['certificate'][
- 'properties']['private_key'].update({'type': 'null'})
diff --git a/tempest/api_schema/response/compute/v2_1/certificates.py b/tempest/api_schema/response/compute/v2_1/certificates.py
index bda6075..35445d8 100644
--- a/tempest/api_schema/response/compute/v2_1/certificates.py
+++ b/tempest/api_schema/response/compute/v2_1/certificates.py
@@ -14,6 +14,26 @@
import copy
-from tempest.api_schema.response.compute import certificates
+_common_schema = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'certificate': {
+ 'type': 'object',
+ 'properties': {
+ 'data': {'type': 'string'},
+ 'private_key': {'type': 'string'},
+ },
+ 'required': ['data', 'private_key']
+ }
+ },
+ 'required': ['certificate']
+ }
+}
-create_certificate = copy.deepcopy(certificates._common_schema)
+get_certificate = copy.deepcopy(_common_schema)
+get_certificate['response_body']['properties']['certificate'][
+ 'properties']['private_key'].update({'type': 'null'})
+
+create_certificate = copy.deepcopy(_common_schema)
diff --git a/tempest/services/compute/json/certificates_client.py b/tempest/services/compute/json/certificates_client.py
index 43ec917..e6b72bb 100644
--- a/tempest/services/compute/json/certificates_client.py
+++ b/tempest/services/compute/json/certificates_client.py
@@ -15,8 +15,7 @@
import json
-from tempest.api_schema.response.compute import certificates as schema
-from tempest.api_schema.response.compute.v2_1 import certificates as v2schema
+from tempest.api_schema.response.compute.v2_1 import certificates as schema
from tempest.common import service_client
@@ -34,5 +33,5 @@
url = "os-certificates"
resp, body = self.post(url, None)
body = json.loads(body)
- self.validate_response(v2schema.create_certificate, resp, body)
+ self.validate_response(schema.create_certificate, resp, body)
return service_client.ResponseBody(resp, body['certificate'])