diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-11-04 12:09:16 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-11-04 12:09:16 +0000 |
commit | 119b3cd6d962a91714c4e7aa45d695ddff92688b (patch) | |
tree | 37845fb8f09e9b76fb622cc9928f6f982d494e2a | |
parent | 14a03237c92f1268092afe947490951b894127b9 (diff) | |
parent | dcd1143c1a71de05bd53fcfb8eadf4c4e7b45438 (diff) | |
download | tempest-lib-119b3cd6d962a91714c4e7aa45d695ddff92688b.tar.gz |
Merge "update unit test about quotas_client"
-rw-r--r-- | tempest_lib/tests/services/compute/test_quotas_client.py | 64 |
1 files changed, 51 insertions, 13 deletions
diff --git a/tempest_lib/tests/services/compute/test_quotas_client.py b/tempest_lib/tests/services/compute/test_quotas_client.py index c1c7c93..9c8fb49 100644 --- a/tempest_lib/tests/services/compute/test_quotas_client.py +++ b/tempest_lib/tests/services/compute/test_quotas_client.py @@ -41,6 +41,7 @@ class TestQuotasClient(base.BaseComputeServiceTest): } project_id = "8421f7be61064f50b680465c07f334af" + fake_user_id = "65f09168cbb04eb593f3138b63b67b67" def setUp(self): super(TestQuotasClient, self).setUp() @@ -48,13 +49,22 @@ class TestQuotasClient(base.BaseComputeServiceTest): self.client = quotas_client.QuotasClient( fake_auth, 'compute', 'regionOne') - def _test_show_quota_set(self, bytes_body=False): - self.check_service_client_function( - self.client.show_quota_set, - 'tempest_lib.common.rest_client.RestClient.get', - self.FAKE_QUOTA_SET, - to_utf=bytes_body, - tenant_id=self.project_id) + def _test_show_quota_set(self, bytes_body=False, user_id=None): + if user_id: + self.check_service_client_function( + self.client.show_quota_set, + 'tempest_lib.common.rest_client.RestClient.get', + self.FAKE_QUOTA_SET, + to_utf=bytes_body, + tenant_id=self.project_id, + user_id=user_id) + else: + self.check_service_client_function( + self.client.show_quota_set, + 'tempest_lib.common.rest_client.RestClient.get', + self.FAKE_QUOTA_SET, + to_utf=bytes_body, + tenant_id=self.project_id) def test_show_quota_set_with_str_body(self): self._test_show_quota_set() @@ -62,6 +72,12 @@ class TestQuotasClient(base.BaseComputeServiceTest): def test_show_quota_set_with_bytes_body(self): self._test_show_quota_set(bytes_body=True) + def test_show_quota_set_for_user_with_str_body(self): + self._test_show_quota_set(user_id=self.fake_user_id) + + def test_show_quota_set_for_user_with_bytes_body(self): + self._test_show_quota_set(bytes_body=True, user_id=self.fake_user_id) + def _test_show_default_quota_set(self, bytes_body=False): self.check_service_client_function( self.client.show_default_quota_set, @@ -76,14 +92,36 @@ class TestQuotasClient(base.BaseComputeServiceTest): def test_show_default_quota_set_with_bytes_body(self): self._test_show_default_quota_set(bytes_body=True) - def test_update_quota_set(self): + def _test_update_quota_set(self, bytes_body=False, user_id=None): fake_quota_set = copy.deepcopy(self.FAKE_QUOTA_SET) fake_quota_set['quota_set'].pop("id") - self.check_service_client_function( - self.client.update_quota_set, - 'tempest_lib.common.rest_client.RestClient.put', - fake_quota_set, - tenant_id=self.project_id) + if user_id: + self.check_service_client_function( + self.client.update_quota_set, + 'tempest_lib.common.rest_client.RestClient.put', + fake_quota_set, + to_utf=bytes_body, + tenant_id=self.project_id, + user_id=user_id) + else: + self.check_service_client_function( + self.client.update_quota_set, + 'tempest_lib.common.rest_client.RestClient.put', + fake_quota_set, + to_utf=bytes_body, + tenant_id=self.project_id) + + def test_update_quota_set_with_str_body(self): + self._test_update_quota_set() + + def test_update_quota_set_with_bytes_body(self): + self._test_update_quota_set(bytes_body=True) + + def test_update_quota_set_for_user_with_str_body(self): + self._test_update_quota_set(user_id=self.fake_user_id) + + def test_update_quota_set_for_user_with_bytes_body(self): + self._test_update_quota_set(bytes_body=True, user_id=self.fake_user_id) def test_delete_quota_set(self): self.check_service_client_function( |