deb-designate/functionaltests/api/v2/clients/quotas_client.py
Paul Glass b82b3c03d9 Zone ownership tests
* There are three tenants: default, alt, and admin
* Updated config to grab creds for each tenant type
* Reworked clients to make tenant selection simple within test cases
* Added zone ownership test cases
* A bit of other refactoring to put code in more sensible places

Change-Id: I5330b2b1f81ac896300f199b341775594ab14073
2015-04-22 16:28:11 +00:00

39 lines
1.4 KiB
Python

"""
Copyright 2015 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from functionaltests.api.v2.models.quotas_model import QuotasModel
from functionaltests.common.client import ClientMixin
class QuotasClient(ClientMixin):
@classmethod
def quotas_uri(cls, tenant_id):
return "/admin/quotas/" + tenant_id
def get_quotas(self, tenant_id, **kwargs):
resp, body = self.client.get(self.quotas_uri(tenant_id), **kwargs)
return self.deserialize(resp, body, QuotasModel)
def patch_quotas(self, tenant_id, quotas_model, **kwargs):
resp, body = self.client.patch(self.quotas_uri(tenant_id),
body=quotas_model.to_json(), **kwargs)
return self.deserialize(resp, body, QuotasModel)
def delete_quotas(self, tenant_id, **kwargs):
resp, body = self.client.patch(self.quotas_uri(tenant_id), **kwargs)
return self.deserialize(resp, body, QuotasModel)