From 2f4f098c6459d7f8ed547ea685067af58acc715e Mon Sep 17 00:00:00 2001 From: He Jie Xu Date: Mon, 9 May 2016 10:44:40 +0800 Subject: [PATCH] Add api-sample test for showing quota detail The method of showing quota detail is missing the api sample test. This patch adds that. Part of bp:api-ref-in-rst Change-Id: I943af1d856f890eab4c34674d251f698ee84a836 --- .../quotas-show-detail-get-resp.json | 75 +++++++++++++++++++ .../quotas-show-detail-get-resp.json.tpl | 75 +++++++++++++++++++ .../api_sample_tests/test_quota_sets.py | 6 ++ 3 files changed, 156 insertions(+) create mode 100644 doc/api_samples/os-quota-sets/quotas-show-detail-get-resp.json create mode 100644 nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-show-detail-get-resp.json.tpl diff --git a/doc/api_samples/os-quota-sets/quotas-show-detail-get-resp.json b/doc/api_samples/os-quota-sets/quotas-show-detail-get-resp.json new file mode 100644 index 000000000000..06ca0f1fba0d --- /dev/null +++ b/doc/api_samples/os-quota-sets/quotas-show-detail-get-resp.json @@ -0,0 +1,75 @@ +{ + "quota_set": { + "cores": { + "in_use": 0, + "limit": 20, + "reserved": 0 + }, + "fixed_ips": { + "in_use": 0, + "limit": -1, + "reserved": 0 + }, + "floating_ips": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "id": "fake_tenant", + "injected_file_content_bytes": { + "in_use": 0, + "limit": 10240, + "reserved": 0 + }, + "injected_file_path_bytes": { + "in_use": 0, + "limit": 255, + "reserved": 0 + }, + "injected_files": { + "in_use": 0, + "limit": 5, + "reserved": 0 + }, + "instances": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "key_pairs": { + "in_use": 0, + "limit": 100, + "reserved": 0 + }, + "metadata_items": { + "in_use": 0, + "limit": 128, + "reserved": 0 + }, + "ram": { + "in_use": 0, + "limit": 51200, + "reserved": 0 + }, + "security_group_rules": { + "in_use": 0, + "limit": 20, + "reserved": 0 + }, + "security_groups": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "server_group_members": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "server_groups": { + "in_use": 0, + "limit": 10, + "reserved": 0 + } + } +} \ No newline at end of file diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-show-detail-get-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-show-detail-get-resp.json.tpl new file mode 100644 index 000000000000..06ca0f1fba0d --- /dev/null +++ b/nova/tests/functional/api_sample_tests/api_samples/os-quota-sets/quotas-show-detail-get-resp.json.tpl @@ -0,0 +1,75 @@ +{ + "quota_set": { + "cores": { + "in_use": 0, + "limit": 20, + "reserved": 0 + }, + "fixed_ips": { + "in_use": 0, + "limit": -1, + "reserved": 0 + }, + "floating_ips": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "id": "fake_tenant", + "injected_file_content_bytes": { + "in_use": 0, + "limit": 10240, + "reserved": 0 + }, + "injected_file_path_bytes": { + "in_use": 0, + "limit": 255, + "reserved": 0 + }, + "injected_files": { + "in_use": 0, + "limit": 5, + "reserved": 0 + }, + "instances": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "key_pairs": { + "in_use": 0, + "limit": 100, + "reserved": 0 + }, + "metadata_items": { + "in_use": 0, + "limit": 128, + "reserved": 0 + }, + "ram": { + "in_use": 0, + "limit": 51200, + "reserved": 0 + }, + "security_group_rules": { + "in_use": 0, + "limit": 20, + "reserved": 0 + }, + "security_groups": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "server_group_members": { + "in_use": 0, + "limit": 10, + "reserved": 0 + }, + "server_groups": { + "in_use": 0, + "limit": 10, + "reserved": 0 + } + } +} \ No newline at end of file diff --git a/nova/tests/functional/api_sample_tests/test_quota_sets.py b/nova/tests/functional/api_sample_tests/test_quota_sets.py index 08ff69b4ff0f..d7ab8367c575 100644 --- a/nova/tests/functional/api_sample_tests/test_quota_sets.py +++ b/nova/tests/functional/api_sample_tests/test_quota_sets.py @@ -51,6 +51,12 @@ class QuotaSetsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): self._verify_response('quotas-show-defaults-get-resp', {}, response, 200) + def test_show_quotas_detail(self): + # Get api sample to show quotas detail. + response = self._do_get('os-quota-sets/fake_tenant/detail') + self._verify_response('quotas-show-detail-get-resp', + {}, response, 200) + def test_update_quotas(self): # Get api sample to update quotas. response = self._do_put('os-quota-sets/fake_tenant',