diff options
| author | Stephen Finucane <stephenfin@redhat.com> | 2020-03-26 15:37:40 +0000 |
|---|---|---|
| committer | Stephen Finucane <stephenfin@redhat.com> | 2020-04-08 13:20:02 +0000 |
| commit | d8e9daafe8018a92fbd87f3b71defb9dfde29b66 (patch) | |
| tree | 3b565677849fbf1174b7a26b7d06a7fcfce989e2 /nova/tests/functional/api | |
| parent | c87b75e0086f65bbdebb07218fd39c57a8d99ed3 (diff) | |
| download | nova-d8e9daafe8018a92fbd87f3b71defb9dfde29b66.tar.gz | |
api: Add microversion for extra spec validation
Enable support for API-based extra spec validation. Since most of the
hard work has been done in previous patches, all that's necessary here
is to wire up the microversion handling and turn things on.
Part of blueprint flavor-extra-spec-validators
Change-Id: If67f0d924ea372746a6dc440ea7bdc655e4f0bea
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Diffstat (limited to 'nova/tests/functional/api')
| -rw-r--r-- | nova/tests/functional/api/client.py | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/nova/tests/functional/api/client.py b/nova/tests/functional/api/client.py index dd38a92750..df7f9a8ea3 100644 --- a/nova/tests/functional/api/client.py +++ b/nova/tests/functional/api/client.py @@ -314,9 +314,31 @@ class TestOpenStackClient(object): def delete_flavor(self, flavor_id): return self.api_delete('/flavors/%s' % flavor_id) - def post_extra_spec(self, flavor_id, spec): - return self.api_post('/flavors/%s/os-extra_specs' % - flavor_id, spec) + def get_extra_specs(self, flavor_id): + return self.api_get( + '/flavors/%s/os-extra_specs' % flavor_id + ).body['extra_specs'] + + def get_extra_spec(self, flavor_id, spec_id): + return self.api_get( + '/flavors/%s/os-extra_specs/%s' % (flavor_id, spec_id), + ).body + + def post_extra_spec(self, flavor_id, body, **_params): + url = '/flavors/%s/os-extra_specs' % flavor_id + if _params: + query_string = '?%s' % parse.urlencode(list(_params.items())) + url += query_string + + return self.api_post(url, body) + + def put_extra_spec(self, flavor_id, spec_id, body, **_params): + url = '/flavors/%s/os-extra_specs/%s' % (flavor_id, spec_id) + if _params: + query_string = '?%s' % parse.urlencode(list(_params.items())) + url += query_string + + return self.api_put(url, body) def get_volume(self, volume_id): return self.api_get('/os-volumes/%s' % volume_id).body['volume'] |
