diff options
author | ghanshyam <ghanshyam.mann@nectechnologies.in> | 2015-03-20 12:09:07 +0900 |
---|---|---|
committer | ghanshyam <ghanshyam.mann@nectechnologies.in> | 2015-03-20 12:09:07 +0900 |
commit | df7a30017ffa1eecff4cc6ddcb3dccbea24217ee (patch) | |
tree | 0b560132d3fa7486356bf360652fa6460e58c6d6 | |
parent | aa93b4bd0b68de56ae0980c7bf027cf86b5fbc5b (diff) | |
download | tempest-df7a30017ffa1eecff4cc6ddcb3dccbea24217ee.tar.gz |
Rearrange keypairs 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 rearrange the keypairs response schema into one file.
Partially implements blueprint rearrange-nova-response-schemas
Change-Id: I76ed40fbe4999c3ee84c4377a6f14fc3a2a11061
-rw-r--r-- | tempest/api_schema/response/compute/keypairs.py | 62 | ||||
-rw-r--r-- | tempest/api_schema/response/compute/v2_1/keypairs.py | 51 | ||||
-rw-r--r-- | tempest/services/compute/json/keypairs_client.py | 3 |
3 files changed, 49 insertions, 67 deletions
diff --git a/tempest/api_schema/response/compute/keypairs.py b/tempest/api_schema/response/compute/keypairs.py deleted file mode 100644 index 2ae410ce9..000000000 --- a/tempest/api_schema/response/compute/keypairs.py +++ /dev/null @@ -1,62 +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. - -list_keypairs = { - 'status_code': [200], - 'response_body': { - 'type': 'object', - 'properties': { - 'keypairs': { - 'type': 'array', - 'items': { - 'type': 'object', - 'properties': { - 'keypair': { - 'type': 'object', - 'properties': { - 'public_key': {'type': 'string'}, - 'name': {'type': 'string'}, - 'fingerprint': {'type': 'string'} - }, - 'required': ['public_key', 'name', 'fingerprint'] - } - }, - 'required': ['keypair'] - } - } - }, - 'required': ['keypairs'] - } -} - -create_keypair = { - 'type': 'object', - 'properties': { - 'keypair': { - 'type': 'object', - 'properties': { - 'fingerprint': {'type': 'string'}, - 'name': {'type': 'string'}, - 'public_key': {'type': 'string'}, - 'user_id': {'type': 'string'}, - 'private_key': {'type': 'string'} - }, - # When create keypair API is being called with 'Public key' - # (Importing keypair) then, response body does not contain - # 'private_key' So it is not defined as 'required' - 'required': ['fingerprint', 'name', 'public_key', 'user_id'] - } - }, - 'required': ['keypair'] -} diff --git a/tempest/api_schema/response/compute/v2_1/keypairs.py b/tempest/api_schema/response/compute/v2_1/keypairs.py index ec26fa02f..ceae6cf9e 100644 --- a/tempest/api_schema/response/compute/v2_1/keypairs.py +++ b/tempest/api_schema/response/compute/v2_1/keypairs.py @@ -12,8 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -from tempest.api_schema.response.compute import keypairs - get_keypair = { 'status_code': [200], 'response_body': { @@ -47,9 +45,56 @@ get_keypair = { create_keypair = { 'status_code': [200], - 'response_body': keypairs.create_keypair + 'response_body': { + 'type': 'object', + 'properties': { + 'keypair': { + 'type': 'object', + 'properties': { + 'fingerprint': {'type': 'string'}, + 'name': {'type': 'string'}, + 'public_key': {'type': 'string'}, + 'user_id': {'type': 'string'}, + 'private_key': {'type': 'string'} + }, + # When create keypair API is being called with 'Public key' + # (Importing keypair) then, response body does not contain + # 'private_key' So it is not defined as 'required' + 'required': ['fingerprint', 'name', 'public_key', 'user_id'] + } + }, + 'required': ['keypair'] + } } delete_keypair = { 'status_code': [202], } + +list_keypairs = { + 'status_code': [200], + 'response_body': { + 'type': 'object', + 'properties': { + 'keypairs': { + 'type': 'array', + 'items': { + 'type': 'object', + 'properties': { + 'keypair': { + 'type': 'object', + 'properties': { + 'public_key': {'type': 'string'}, + 'name': {'type': 'string'}, + 'fingerprint': {'type': 'string'} + }, + 'required': ['public_key', 'name', 'fingerprint'] + } + }, + 'required': ['keypair'] + } + } + }, + 'required': ['keypairs'] + } +} diff --git a/tempest/services/compute/json/keypairs_client.py b/tempest/services/compute/json/keypairs_client.py index 722aefab7..7fe335bf7 100644 --- a/tempest/services/compute/json/keypairs_client.py +++ b/tempest/services/compute/json/keypairs_client.py @@ -15,7 +15,6 @@ import json -from tempest.api_schema.response.compute import keypairs as common_schema from tempest.api_schema.response.compute.v2_1 import keypairs as schema from tempest.common import service_client @@ -30,7 +29,7 @@ class KeyPairsClientJSON(service_client.ServiceClient): # servers, etc. A bug? # For now we shall adhere to the spec, but the spec for keypairs # is yet to be found - self.validate_response(common_schema.list_keypairs, resp, body) + self.validate_response(schema.list_keypairs, resp, body) return service_client.ResponseBodyList(resp, body['keypairs']) def get_keypair(self, key_name): |