blob: dbff275836a7ec4f6907e6e0bfc3e378024a7452 [file] [log] [blame]
Rohit Karajgi07599c52012-11-02 05:35:16 -07001# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2012 OpenStack, LLC
4# All Rights Reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
Chris Yeoh9465b0b2013-02-09 22:19:15 +103018from tempest.test import attr
rajalakshmi-ganesan1982c3c2013-01-10 14:56:45 +053019from tempest.tests.compute import base
Rohit Karajgi07599c52012-11-02 05:35:16 -070020
21
Attila Fazekas19044d52013-02-16 07:35:06 +010022class QuotasTestJSON(base.BaseComputeTest):
23 _interface = 'json'
Rohit Karajgi07599c52012-11-02 05:35:16 -070024
25 @classmethod
26 def setUpClass(cls):
Attila Fazekas19044d52013-02-16 07:35:06 +010027 super(QuotasTestJSON, cls).setUpClass()
Rohit Karajgi07599c52012-11-02 05:35:16 -070028 cls.client = cls.quotas_client
29 cls.admin_client = cls._get_identity_admin_client()
30 resp, tenants = cls.admin_client.list_tenants()
31 cls.tenant_id = [tnt['id'] for tnt in tenants if tnt['name'] ==
32 cls.client.tenant_name][0]
33
34 @attr(type='smoke')
35 def test_get_default_quotas(self):
Sean Dague4dd2c0b2013-01-03 17:50:28 -050036 # User can get the default quota set for it's tenant
Rohit Karajgi07599c52012-11-02 05:35:16 -070037 expected_quota_set = {'injected_file_content_bytes': 10240,
38 'metadata_items': 128, 'injected_files': 5,
39 'ram': 51200, 'floating_ips': 10,
40 'key_pairs': 100,
41 'injected_file_path_bytes': 255, 'instances': 10,
42 'security_group_rules': 20, 'cores': 20,
43 'id': self.tenant_id, 'security_groups': 10}
44 try:
45 resp, quota_set = self.client.get_quota_set(self.tenant_id)
46 self.assertEqual(200, resp.status)
Michael J Forkba49e4e2013-02-07 21:21:14 +000047 self.assertEqual(expected_quota_set, quota_set)
Matthew Treinish05d9fb92012-12-07 16:14:05 -050048 except Exception:
Rohit Karajgi07599c52012-11-02 05:35:16 -070049 self.fail("Quota set for tenant did not have default limits")
rajalakshmi-ganesan1982c3c2013-01-10 14:56:45 +053050
51
Attila Fazekas19044d52013-02-16 07:35:06 +010052class QuotasTestXML(QuotasTestJSON):
53 _interface = 'xml'