diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2012-08-30 13:50:25 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2012-08-31 13:19:10 -0700 |
| commit | 2a5da84eb665d4aaef8ed84a51cf271b6466106f (patch) | |
| tree | 8260e78d60100a3fa5fadf73a870498c88ae5ac2 | |
| parent | e73afde84c382a6191d348aa0310e630909342d7 (diff) | |
| download | nova-2a5da84eb665d4aaef8ed84a51cf271b6466106f.tar.gz nova-2a5da84eb665d4aaef8ed84a51cf271b6466106f.tar.xz nova-2a5da84eb665d4aaef8ed84a51cf271b6466106f.zip | |
Add api sample tests for flavors endpoint
Adds samples for GET /flavors and GET /flavors/1
Change-Id: I864996a5f92fa8a553c013e0df09bfdf8f04c659
17 files changed, 523 insertions, 0 deletions
diff --git a/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.json b/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.json new file mode 100644 index 000000000..bbd681e66 --- /dev/null +++ b/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.json @@ -0,0 +1,24 @@ +{ + "flavor": { + "OS-FLV-DISABLED:disabled": false, + "OS-FLV-EXT-DATA:ephemeral": 0, + "disk": 0, + "id": "1", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/1", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/1", + "rel": "bookmark" + } + ], + "name": "m1.tiny", + "os-flavor-access:is_public": true, + "ram": 512, + "rxtx_factor": 1.0, + "swap": "", + "vcpus": 1 + } +}
\ No newline at end of file diff --git a/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.json.tpl b/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.json.tpl new file mode 100644 index 000000000..bbd681e66 --- /dev/null +++ b/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.json.tpl @@ -0,0 +1,24 @@ +{ + "flavor": { + "OS-FLV-DISABLED:disabled": false, + "OS-FLV-EXT-DATA:ephemeral": 0, + "disk": 0, + "id": "1", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/1", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/1", + "rel": "bookmark" + } + ], + "name": "m1.tiny", + "os-flavor-access:is_public": true, + "ram": 512, + "rxtx_factor": 1.0, + "swap": "", + "vcpus": 1 + } +}
\ No newline at end of file diff --git a/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.xml b/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.xml new file mode 100644 index 000000000..fe0451c1e --- /dev/null +++ b/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.xml @@ -0,0 +1,5 @@ +<?xml version='1.0' encoding='UTF-8'?> +<flavor xmlns:OS-FLV-DISABLED="http://docs.openstack.org/compute/ext/flavor_disabled/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:OS-FLV-EXT-DATA="http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1" xmlns:os-flavor-access="http://docs.openstack.org/compute/ext/flavor_access/api/v2" xmlns="http://docs.openstack.org/compute/api/v1.1" name="m1.tiny" ram="512" vcpus="1" swap="" rxtx_factor="1.0" disk="0" id="1" os-flavor-access:is_public="True" OS-FLV-EXT-DATA:ephemeral="0" OS-FLV-DISABLED:disabled="False"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/> +</flavor>
\ No newline at end of file diff --git a/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.xml.tpl b/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.xml.tpl new file mode 100644 index 000000000..920b82e53 --- /dev/null +++ b/nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.xml.tpl @@ -0,0 +1,5 @@ +<?xml version='1.0' encoding='UTF-8'?> +<flavor xmlns:OS-FLV-DISABLED="http://docs.openstack.org/compute/ext/flavor_disabled/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:OS-FLV-EXT-DATA="http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1" xmlns:os-flavor-access="http://docs.openstack.org/compute/ext/flavor_access/api/v2" xmlns="http://docs.openstack.org/compute/api/v1.1" name="m1.tiny" ram="512" vcpus="1" swap="" rxtx_factor="1.0" disk="0" id="1" os-flavor-access:is_public="True" OS-FLV-EXT-DATA:ephemeral="0" OS-FLV-DISABLED:disabled="False"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/> +</flavor> diff --git a/nova/tests/integrated/api_samples/all_extensions/flavors-list-resp.json b/nova/tests/integrated/api_samples/all_extensions/flavors-list-resp.json new file mode 100644 index 000000000..ab86d2a52 --- /dev/null +++ b/nova/tests/integrated/api_samples/all_extensions/flavors-list-resp.json @@ -0,0 +1,74 @@ +{ + "flavors": [ + { + "id": "1", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/1", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/1", + "rel": "bookmark" + } + ], + "name": "m1.tiny" + }, + { + "id": "2", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/2", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/2", + "rel": "bookmark" + } + ], + "name": "m1.small" + }, + { + "id": "3", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/3", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/3", + "rel": "bookmark" + } + ], + "name": "m1.medium" + }, + { + "id": "4", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/4", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/4", + "rel": "bookmark" + } + ], + "name": "m1.large" + }, + { + "id": "5", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/5", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/5", + "rel": "bookmark" + } + ], + "name": "m1.xlarge" + } + ] +}
\ No newline at end of file diff --git a/nova/tests/integrated/api_samples/all_extensions/flavors-list-resp.json.tpl b/nova/tests/integrated/api_samples/all_extensions/flavors-list-resp.json.tpl new file mode 100644 index 000000000..ab86d2a52 --- /dev/null +++ b/nova/tests/integrated/api_samples/all_extensions/flavors-list-resp.json.tpl @@ -0,0 +1,74 @@ +{ + "flavors": [ + { + "id": "1", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/1", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/1", + "rel": "bookmark" + } + ], + "name": "m1.tiny" + }, + { + "id": "2", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/2", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/2", + "rel": "bookmark" + } + ], + "name": "m1.small" + }, + { + "id": "3", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/3", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/3", + "rel": "bookmark" + } + ], + "name": "m1.medium" + }, + { + "id": "4", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/4", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/4", + "rel": "bookmark" + } + ], + "name": "m1.large" + }, + { + "id": "5", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/5", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/5", + "rel": "bookmark" + } + ], + "name": "m1.xlarge" + } + ] +}
\ No newline at end of file diff --git a/nova/tests/integrated/api_samples/all_extensions/flavors-list-resp.xml b/nova/tests/integrated/api_samples/all_extensions/flavors-list-resp.xml new file mode 100644 index 000000000..435f96be5 --- /dev/null +++ b/nova/tests/integrated/api_samples/all_extensions/flavors-list-resp.xml @@ -0,0 +1,23 @@ +<?xml version='1.0' encoding='UTF-8'?> +<flavors xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1"> + <flavor name="m1.tiny" id="1"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/> + </flavor> + <flavor name="m1.small" id="2"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/2" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/2" rel="bookmark"/> + </flavor> + <flavor name="m1.medium" id="3"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/3" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/3" rel="bookmark"/> + </flavor> + <flavor name="m1.large" id="4"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/4" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/4" rel="bookmark"/> + </flavor> + <flavor name="m1.xlarge" id="5"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/5" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/5" rel="bookmark"/> + </flavor> +</flavors>
\ No newline at end of file diff --git a/nova/tests/integrated/api_samples/all_extensions/flavors-list-resp.xml.tpl b/nova/tests/integrated/api_samples/all_extensions/flavors-list-resp.xml.tpl new file mode 100644 index 000000000..435f96be5 --- /dev/null +++ b/nova/tests/integrated/api_samples/all_extensions/flavors-list-resp.xml.tpl @@ -0,0 +1,23 @@ +<?xml version='1.0' encoding='UTF-8'?> +<flavors xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1"> + <flavor name="m1.tiny" id="1"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/> + </flavor> + <flavor name="m1.small" id="2"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/2" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/2" rel="bookmark"/> + </flavor> + <flavor name="m1.medium" id="3"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/3" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/3" rel="bookmark"/> + </flavor> + <flavor name="m1.large" id="4"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/4" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/4" rel="bookmark"/> + </flavor> + <flavor name="m1.xlarge" id="5"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/5" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/5" rel="bookmark"/> + </flavor> +</flavors>
\ No newline at end of file diff --git a/nova/tests/integrated/api_samples/flavor-get-resp.json b/nova/tests/integrated/api_samples/flavor-get-resp.json new file mode 100644 index 000000000..e2df82862 --- /dev/null +++ b/nova/tests/integrated/api_samples/flavor-get-resp.json @@ -0,0 +1,21 @@ +{ + "flavor": { + "disk": 0, + "id": "1", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/1", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/1", + "rel": "bookmark" + } + ], + "name": "m1.tiny", + "ram": 512, + "rxtx_factor": 1.0, + "swap": "", + "vcpus": 1 + } +}
\ No newline at end of file diff --git a/nova/tests/integrated/api_samples/flavor-get-resp.json.tpl b/nova/tests/integrated/api_samples/flavor-get-resp.json.tpl new file mode 100644 index 000000000..e2df82862 --- /dev/null +++ b/nova/tests/integrated/api_samples/flavor-get-resp.json.tpl @@ -0,0 +1,21 @@ +{ + "flavor": { + "disk": 0, + "id": "1", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/1", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/1", + "rel": "bookmark" + } + ], + "name": "m1.tiny", + "ram": 512, + "rxtx_factor": 1.0, + "swap": "", + "vcpus": 1 + } +}
\ No newline at end of file diff --git a/nova/tests/integrated/api_samples/flavor-get-resp.xml b/nova/tests/integrated/api_samples/flavor-get-resp.xml new file mode 100644 index 000000000..ddc4300ec --- /dev/null +++ b/nova/tests/integrated/api_samples/flavor-get-resp.xml @@ -0,0 +1,5 @@ +<?xml version='1.0' encoding='UTF-8'?> +<flavor xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" name="m1.tiny" ram="512" vcpus="1" swap="" rxtx_factor="1.0" disk="0" id="1"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/> +</flavor>
\ No newline at end of file diff --git a/nova/tests/integrated/api_samples/flavor-get-resp.xml.tpl b/nova/tests/integrated/api_samples/flavor-get-resp.xml.tpl new file mode 100644 index 000000000..ddc4300ec --- /dev/null +++ b/nova/tests/integrated/api_samples/flavor-get-resp.xml.tpl @@ -0,0 +1,5 @@ +<?xml version='1.0' encoding='UTF-8'?> +<flavor xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" name="m1.tiny" ram="512" vcpus="1" swap="" rxtx_factor="1.0" disk="0" id="1"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/> +</flavor>
\ No newline at end of file diff --git a/nova/tests/integrated/api_samples/flavors-list-resp.json b/nova/tests/integrated/api_samples/flavors-list-resp.json new file mode 100644 index 000000000..ab86d2a52 --- /dev/null +++ b/nova/tests/integrated/api_samples/flavors-list-resp.json @@ -0,0 +1,74 @@ +{ + "flavors": [ + { + "id": "1", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/1", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/1", + "rel": "bookmark" + } + ], + "name": "m1.tiny" + }, + { + "id": "2", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/2", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/2", + "rel": "bookmark" + } + ], + "name": "m1.small" + }, + { + "id": "3", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/3", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/3", + "rel": "bookmark" + } + ], + "name": "m1.medium" + }, + { + "id": "4", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/4", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/4", + "rel": "bookmark" + } + ], + "name": "m1.large" + }, + { + "id": "5", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/5", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/5", + "rel": "bookmark" + } + ], + "name": "m1.xlarge" + } + ] +}
\ No newline at end of file diff --git a/nova/tests/integrated/api_samples/flavors-list-resp.json.tpl b/nova/tests/integrated/api_samples/flavors-list-resp.json.tpl new file mode 100644 index 000000000..ab86d2a52 --- /dev/null +++ b/nova/tests/integrated/api_samples/flavors-list-resp.json.tpl @@ -0,0 +1,74 @@ +{ + "flavors": [ + { + "id": "1", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/1", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/1", + "rel": "bookmark" + } + ], + "name": "m1.tiny" + }, + { + "id": "2", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/2", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/2", + "rel": "bookmark" + } + ], + "name": "m1.small" + }, + { + "id": "3", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/3", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/3", + "rel": "bookmark" + } + ], + "name": "m1.medium" + }, + { + "id": "4", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/4", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/4", + "rel": "bookmark" + } + ], + "name": "m1.large" + }, + { + "id": "5", + "links": [ + { + "href": "http://openstack.example.com/v2/openstack/flavors/5", + "rel": "self" + }, + { + "href": "http://openstack.example.com/openstack/flavors/5", + "rel": "bookmark" + } + ], + "name": "m1.xlarge" + } + ] +}
\ No newline at end of file diff --git a/nova/tests/integrated/api_samples/flavors-list-resp.xml b/nova/tests/integrated/api_samples/flavors-list-resp.xml new file mode 100644 index 000000000..435f96be5 --- /dev/null +++ b/nova/tests/integrated/api_samples/flavors-list-resp.xml @@ -0,0 +1,23 @@ +<?xml version='1.0' encoding='UTF-8'?> +<flavors xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1"> + <flavor name="m1.tiny" id="1"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/> + </flavor> + <flavor name="m1.small" id="2"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/2" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/2" rel="bookmark"/> + </flavor> + <flavor name="m1.medium" id="3"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/3" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/3" rel="bookmark"/> + </flavor> + <flavor name="m1.large" id="4"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/4" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/4" rel="bookmark"/> + </flavor> + <flavor name="m1.xlarge" id="5"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/5" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/5" rel="bookmark"/> + </flavor> +</flavors>
\ No newline at end of file diff --git a/nova/tests/integrated/api_samples/flavors-list-resp.xml.tpl b/nova/tests/integrated/api_samples/flavors-list-resp.xml.tpl new file mode 100644 index 000000000..435f96be5 --- /dev/null +++ b/nova/tests/integrated/api_samples/flavors-list-resp.xml.tpl @@ -0,0 +1,23 @@ +<?xml version='1.0' encoding='UTF-8'?> +<flavors xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1"> + <flavor name="m1.tiny" id="1"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/1" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/1" rel="bookmark"/> + </flavor> + <flavor name="m1.small" id="2"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/2" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/2" rel="bookmark"/> + </flavor> + <flavor name="m1.medium" id="3"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/3" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/3" rel="bookmark"/> + </flavor> + <flavor name="m1.large" id="4"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/4" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/4" rel="bookmark"/> + </flavor> + <flavor name="m1.xlarge" id="5"> + <atom:link href="http://openstack.example.com/v2/openstack/flavors/5" rel="self"/> + <atom:link href="http://openstack.example.com/openstack/flavors/5" rel="bookmark"/> + </flavor> +</flavors>
\ No newline at end of file diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py index 89c16c6fb..60b2e3c8a 100644 --- a/nova/tests/integrated/test_api_samples.py +++ b/nova/tests/integrated/test_api_samples.py @@ -248,3 +248,28 @@ class ExtensionsSampleJsonTest(ApiSampleTestBase): class ExtensionsSampleXmlTest(ExtensionsSampleJsonTest): ctype = 'xml' + + +class FlavorsSampleJsonTest(ApiSampleTestBase): + + def test_flavors_get(self): + response = self._do_get('flavors/1') + subs = self._get_regexes() + return self._verify_response('flavor-get-resp', subs, response) + + def test_flavors_list(self): + response = self._do_get('flavors') + subs = self._get_regexes() + return self._verify_response('flavors-list-resp', subs, response) + + +class FlavorsSampleXmlTest(FlavorsSampleJsonTest): + ctype = 'xml' + + +class FlavorsSampleAllExtensionJsonTest(FlavorsSampleJsonTest): + all_extensions = True + + +class FlavorsSampleAllExtensionXmlTest(FlavorsSampleXmlTest): + all_extensions = True |
