|
| 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 import version |
| 16 | + |
| 17 | +IDENTIFIER = 'v2.0' |
| 18 | +EXAMPLE = { |
| 19 | + 'id': IDENTIFIER, |
| 20 | + 'links': '2', |
| 21 | + 'status': '3', |
| 22 | +} |
| 23 | + |
| 24 | + |
| 25 | +class TestVersion(testtools.TestCase): |
| 26 | + |
| 27 | + def test_basic(self): |
| 28 | + sot = version.Version() |
| 29 | + self.assertEqual('version', sot.resource_key) |
| 30 | + self.assertEqual('versions', sot.resources_key) |
| 31 | + self.assertEqual('/', sot.base_path) |
| 32 | + self.assertEqual('network', sot.service.service_type) |
| 33 | + self.assertFalse(sot.allow_create) |
| 34 | + self.assertFalse(sot.allow_retrieve) |
| 35 | + self.assertFalse(sot.allow_update) |
| 36 | + self.assertFalse(sot.allow_delete) |
| 37 | + self.assertTrue(sot.allow_list) |
| 38 | + |
| 39 | + def test_make_it(self): |
| 40 | + sot = version.Version(EXAMPLE) |
| 41 | + self.assertEqual(EXAMPLE['id'], sot.id) |
| 42 | + self.assertEqual(EXAMPLE['links'], sot.links) |
| 43 | + self.assertEqual(EXAMPLE['status'], sot.status) |
0 commit comments