|
| 1 | +# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 2 | +# not use this file except in compliance with the License. You may obtain |
| 3 | +# a copy of the License at |
| 4 | +# |
| 5 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | +# |
| 7 | +# Unless required by applicable law or agreed to in writing, software |
| 8 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 | +# License for the specific language governing permissions and limitations |
| 11 | +# under the License. |
| 12 | + |
| 13 | +import testtools |
| 14 | + |
| 15 | +from openstack.network.v2 import quota |
| 16 | + |
| 17 | +IDENTIFIER = 'IDENTIFIER' |
| 18 | +EXAMPLE = { |
| 19 | + 'floatingip': 1, |
| 20 | + 'network': 2, |
| 21 | + 'port': 3, |
| 22 | + 'tenant_id': '4', |
| 23 | + 'router': 5, |
| 24 | + 'subnet': 6, |
| 25 | +} |
| 26 | + |
| 27 | + |
| 28 | +class TestQuota(testtools.TestCase): |
| 29 | + |
| 30 | + def test_basic(self): |
| 31 | + sot = quota.Quota() |
| 32 | + self.assertEqual('quota', sot.resource_key) |
| 33 | + self.assertEqual('quotas', sot.resources_key) |
| 34 | + self.assertEqual('/v2.0/quotas', sot.base_path) |
| 35 | + self.assertEqual('network', sot.service.service_type) |
| 36 | + self.assertFalse(sot.allow_create) |
| 37 | + self.assertFalse(sot.allow_retrieve) |
| 38 | + self.assertFalse(sot.allow_update) |
| 39 | + self.assertFalse(sot.allow_delete) |
| 40 | + self.assertTrue(sot.allow_list) |
| 41 | + |
| 42 | + def test_make_it(self): |
| 43 | + sot = quota.Quota(EXAMPLE) |
| 44 | + self.assertEqual(EXAMPLE['floatingip'], sot.floating_ip) |
| 45 | + self.assertEqual(EXAMPLE['network'], sot.network) |
| 46 | + self.assertEqual(EXAMPLE['port'], sot.port) |
| 47 | + self.assertEqual(EXAMPLE['tenant_id'], sot.project_id) |
| 48 | + self.assertEqual(EXAMPLE['router'], sot.router) |
| 49 | + self.assertEqual(EXAMPLE['subnet'], sot.subnet) |
0 commit comments