summaryrefslogtreecommitdiff
path: root/novaclient/tests/unit/v2/test_quota_classes.py
diff options
context:
space:
mode:
Diffstat (limited to 'novaclient/tests/unit/v2/test_quota_classes.py')
-rw-r--r--novaclient/tests/unit/v2/test_quota_classes.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/novaclient/tests/unit/v2/test_quota_classes.py b/novaclient/tests/unit/v2/test_quota_classes.py
new file mode 100644
index 0000000..467ff83
--- /dev/null
+++ b/novaclient/tests/unit/v2/test_quota_classes.py
@@ -0,0 +1,42 @@
1# Copyright 2011 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from novaclient.tests.unit import utils
17from novaclient.tests.unit.v2 import fakes
18
19
20cs = fakes.FakeClient()
21
22
23class QuotaClassSetsTest(utils.TestCase):
24
25 def test_class_quotas_get(self):
26 class_name = 'test'
27 cs.quota_classes.get(class_name)
28 cs.assert_called('GET', '/os-quota-class-sets/%s' % class_name)
29
30 def test_update_quota(self):
31 q = cs.quota_classes.get('test')
32 q.update(cores=2)
33 cs.assert_called('PUT', '/os-quota-class-sets/test')
34
35 def test_refresh_quota(self):
36 q = cs.quota_classes.get('test')
37 q2 = cs.quota_classes.get('test')
38 self.assertEqual(q.cores, q2.cores)
39 q2.cores = 0
40 self.assertNotEqual(q.cores, q2.cores)
41 q2.get()
42 self.assertEqual(q.cores, q2.cores)