|
| 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 | + |
| 14 | +from cinderclient.tests.functional import base |
| 15 | + |
| 16 | + |
| 17 | +class CinderClientReadOnlyTests(base.ClientTestBase): |
| 18 | + """Basic read-only test for cinderclient. |
| 19 | +
|
| 20 | + Simple check of base list commands, verify they |
| 21 | + respond and include the expected headers in the |
| 22 | + resultant table. |
| 23 | +
|
| 24 | + Not intended for testing things that require actual |
| 25 | + resource creation/manipulation, thus the name 'read-only'. |
| 26 | +
|
| 27 | + """ |
| 28 | + |
| 29 | + # Commands in order listed in 'cinder help' |
| 30 | + def test_absolute_limits(self): |
| 31 | + limits = self.parser.listing(self.cinder('absolute-limits')) |
| 32 | + self.assertTableStruct(limits, ['Name', 'Value']) |
| 33 | + |
| 34 | + def test_availability_zones(self): |
| 35 | + zone_list = self.parser.listing(self.cinder('availability-zone-list')) |
| 36 | + self.assertTableStruct(zone_list, ['Name', 'Status']) |
| 37 | + |
| 38 | + def test_backup_list(self): |
| 39 | + backup_list = self.parser.listing(self.cinder('backup-list')) |
| 40 | + self.assertTableStruct(backup_list, ['ID', 'Volume ID', 'Status', |
| 41 | + 'Name', 'Size', 'Object Count', |
| 42 | + 'Container']) |
| 43 | + |
| 44 | + def test_encryption_type_list(self): |
| 45 | + encrypt_list = self.parser.listing(self.cinder('encryption-type-list')) |
| 46 | + self.assertTableStruct(encrypt_list, ['Volume Type ID', 'Provider', |
| 47 | + 'Cipher', 'Key Size', |
| 48 | + 'Control Location']) |
| 49 | + |
| 50 | + def test_endpoints(self): |
| 51 | + out = self.cinder('endpoints') |
| 52 | + tables = self.parser.tables(out) |
| 53 | + for table in tables: |
| 54 | + headers = table['headers'] |
| 55 | + self.assertTrue(2 >= len(headers)) |
| 56 | + self.assertEqual('Value', headers[1]) |
| 57 | + |
| 58 | + def test_list(self): |
| 59 | + list = self.parser.listing(self.cinder('list')) |
| 60 | + self.assertTableStruct(list, ['ID', 'Status', 'Name', 'Size', |
| 61 | + 'Volume Type', 'Bootable', |
| 62 | + 'Attached to']) |
| 63 | + |
| 64 | + def test_qos_list(self): |
| 65 | + qos_list = self.parser.listing(self.cinder('qos-list')) |
| 66 | + self.assertTableStruct(qos_list, ['ID', 'Name', 'Consumer', 'specs']) |
| 67 | + |
| 68 | + def test_rate_limits(self): |
| 69 | + rate_limits = self.parser.listing(self.cinder('rate-limits')) |
| 70 | + self.assertTableStruct(rate_limits, ['Verb', 'URI', 'Value', 'Remain', |
| 71 | + 'Unit', 'Next_Available']) |
| 72 | + |
| 73 | + def test_service_list(self): |
| 74 | + service_list = self.parser.listing(self.cinder('service-list')) |
| 75 | + self.assertTableStruct(service_list, ['Binary', 'Host', 'Zone', |
| 76 | + 'Status', 'State', 'Updated_at']) |
| 77 | + |
| 78 | + def test_snapshot_list(self): |
| 79 | + snapshot_list = self.parser.listing(self.cinder('snapshot-list')) |
| 80 | + self.assertTableStruct(snapshot_list, ['ID', 'Volume ID', 'Status', |
| 81 | + 'Name', 'Size']) |
| 82 | + |
| 83 | + def test_transfer_list(self): |
| 84 | + transfer_list = self.parser.listing(self.cinder('transfer-list')) |
| 85 | + self.assertTableStruct(transfer_list, ['ID', 'Volume ID', 'Name']) |
| 86 | + |
| 87 | + def test_type_list(self): |
| 88 | + type_list = self.parser.listing(self.cinder('type-list')) |
| 89 | + self.assertTableStruct(type_list, ['ID', 'Name']) |
0 commit comments