From 2a5da84eb665d4aaef8ed84a51cf271b6466106f Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 30 Aug 2012 13:50:25 -0700 Subject: Add api sample tests for flavors endpoint Adds samples for GET /flavors and GET /flavors/1 Change-Id: I864996a5f92fa8a553c013e0df09bfdf8f04c659 --- .../all_extensions/flavor-get-resp.json | 24 +++++++ .../all_extensions/flavor-get-resp.json.tpl | 24 +++++++ .../api_samples/all_extensions/flavor-get-resp.xml | 5 ++ .../all_extensions/flavor-get-resp.xml.tpl | 5 ++ .../all_extensions/flavors-list-resp.json | 74 ++++++++++++++++++++++ .../all_extensions/flavors-list-resp.json.tpl | 74 ++++++++++++++++++++++ .../all_extensions/flavors-list-resp.xml | 23 +++++++ .../all_extensions/flavors-list-resp.xml.tpl | 23 +++++++ .../integrated/api_samples/flavor-get-resp.json | 21 ++++++ .../api_samples/flavor-get-resp.json.tpl | 21 ++++++ .../integrated/api_samples/flavor-get-resp.xml | 5 ++ .../integrated/api_samples/flavor-get-resp.xml.tpl | 5 ++ .../integrated/api_samples/flavors-list-resp.json | 74 ++++++++++++++++++++++ .../api_samples/flavors-list-resp.json.tpl | 74 ++++++++++++++++++++++ .../integrated/api_samples/flavors-list-resp.xml | 23 +++++++ .../api_samples/flavors-list-resp.xml.tpl | 23 +++++++ nova/tests/integrated/test_api_samples.py | 25 ++++++++ 17 files changed, 523 insertions(+) create mode 100644 nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.json create mode 100644 nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.json.tpl create mode 100644 nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.xml create mode 100644 nova/tests/integrated/api_samples/all_extensions/flavor-get-resp.xml.tpl create mode 100644 nova/tests/integrated/api_samples/all_extensions/flavors-list-resp.json create mode 100644 nova/tests/integrated/api_samples/all_extensions/flavors-list-resp.json.tpl create mode 100644 nova/tests/integrated/api_samples/all_extensions/flavors-list-resp.xml create mode 100644 nova/tests/integrated/api_samples/all_extensions/flavors-list-resp.xml.tpl create mode 100644 nova/tests/integrated/api_samples/flavor-get-resp.json create mode 100644 nova/tests/integrated/api_samples/flavor-get-resp.json.tpl create mode 100644 nova/tests/integrated/api_samples/flavor-get-resp.xml create mode 100644 nova/tests/integrated/api_samples/flavor-get-resp.xml.tpl create mode 100644 nova/tests/integrated/api_samples/flavors-list-resp.json create mode 100644 nova/tests/integrated/api_samples/flavors-list-resp.json.tpl create mode 100644 nova/tests/integrated/api_samples/flavors-list-resp.xml create mode 100644 nova/tests/integrated/api_samples/flavors-list-resp.xml.tpl 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 @@ + + + + + \ 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 @@ + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + \ 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 @@ + + + + + + + + + + + + + + + + + + + + + + + \ 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 @@ + + + + + \ 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 @@ + + + + + \ 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 @@ + + + + + + + + + + + + + + + + + + + + + + + \ 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 @@ + + + + + + + + + + + + + + + + + + + + + + + \ 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 -- cgit