Haiwei Xu | 88173c8 | 2014-03-20 03:15:13 +0900 | [diff] [blame] | 1 | # Copyright 2014 NEC Corporation. All rights reserved. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
Haiwei Xu | e20f9b7 | 2014-04-08 21:59:02 +0900 | [diff] [blame] | 15 | import copy |
| 16 | |
Haiwei Xu | 7e40d02 | 2014-03-25 22:42:13 +0900 | [diff] [blame] | 17 | aggregate = { |
| 18 | 'type': 'object', |
Haiwei Xu | e20f9b7 | 2014-04-08 21:59:02 +0900 | [diff] [blame] | 19 | 'properties': { |
Haiwei Xu | 7e40d02 | 2014-03-25 22:42:13 +0900 | [diff] [blame] | 20 | 'availability_zone': {'type': ['string', 'null']}, |
| 21 | 'created_at': {'type': 'string'}, |
| 22 | 'deleted': {'type': 'boolean'}, |
| 23 | 'deleted_at': {'type': ['string', 'null']}, |
| 24 | 'hosts': {'type': 'array'}, |
| 25 | 'id': {'type': 'integer'}, |
| 26 | 'metadata': {'type': 'object'}, |
| 27 | 'name': {'type': 'string'}, |
| 28 | 'updated_at': {'type': ['string', 'null']} |
| 29 | }, |
| 30 | 'required': ['availability_zone', 'created_at', 'deleted', |
| 31 | 'deleted_at', 'hosts', 'id', 'metadata', |
| 32 | 'name', 'updated_at'] |
| 33 | } |
| 34 | |
Haiwei Xu | 88173c8 | 2014-03-20 03:15:13 +0900 | [diff] [blame] | 35 | list_aggregates = { |
| 36 | 'status_code': [200], |
| 37 | 'response_body': { |
| 38 | 'type': 'object', |
| 39 | 'properties': { |
| 40 | 'aggregates': { |
| 41 | 'type': 'array', |
Haiwei Xu | 7e40d02 | 2014-03-25 22:42:13 +0900 | [diff] [blame] | 42 | 'items': aggregate |
Haiwei Xu | 88173c8 | 2014-03-20 03:15:13 +0900 | [diff] [blame] | 43 | } |
| 44 | }, |
| 45 | 'required': ['aggregates'] |
| 46 | } |
| 47 | } |
Haiwei Xu | 7e40d02 | 2014-03-25 22:42:13 +0900 | [diff] [blame] | 48 | |
| 49 | get_aggregate = { |
| 50 | 'status_code': [200], |
| 51 | 'response_body': { |
| 52 | 'type': 'object', |
| 53 | 'properties': { |
| 54 | 'aggregate': aggregate |
| 55 | }, |
| 56 | 'required': ['aggregate'] |
| 57 | } |
| 58 | } |
Haiwei Xu | ddd3cda | 2014-04-03 23:39:48 +0900 | [diff] [blame] | 59 | |
| 60 | aggregate_set_metadata = get_aggregate |
Haiwei Xu | e20f9b7 | 2014-04-08 21:59:02 +0900 | [diff] [blame] | 61 | # The 'updated_at' attribute of 'update_aggregate' can't be null. |
| 62 | update_aggregate = copy.deepcopy(get_aggregate) |
| 63 | update_aggregate['response_body']['properties']['aggregate']['properties'][ |
| 64 | 'updated_at'] = { |
| 65 | 'type': 'string' |
| 66 | } |