|
| 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 | +from functional.tests.identity.v3 import test_identity |
| 14 | +from tempest_lib.common.utils import data_utils |
| 15 | + |
| 16 | + |
| 17 | +class ServiceProviderTests(test_identity.IdentityTests): |
| 18 | + # Introduce functional test cases for command 'Service Provider' |
| 19 | + |
| 20 | + def test_sp_create(self): |
| 21 | + self._create_dummy_sp(add_clean_up=True) |
| 22 | + |
| 23 | + def test_sp_delete(self): |
| 24 | + service_provider = self._create_dummy_sp(add_clean_up=False) |
| 25 | + raw_output = self.openstack('service provider delete %s' |
| 26 | + % service_provider) |
| 27 | + self.assertEqual(0, len(raw_output)) |
| 28 | + |
| 29 | + def test_sp_show(self): |
| 30 | + service_provider = self._create_dummy_sp(add_clean_up=True) |
| 31 | + raw_output = self.openstack('service provider show %s' |
| 32 | + % service_provider) |
| 33 | + items = self.parse_show(raw_output) |
| 34 | + self.assert_show_fields(items, self.SERVICE_PROVIDER_FIELDS) |
| 35 | + |
| 36 | + def test_sp_list(self): |
| 37 | + self._create_dummy_sp(add_clean_up=True) |
| 38 | + raw_output = self.openstack('service provider list') |
| 39 | + items = self.parse_listing(raw_output) |
| 40 | + self.assert_table_structure(items, self.SERVICE_PROVIDER_LIST_HEADERS) |
| 41 | + |
| 42 | + def test_sp_set(self): |
| 43 | + service_provider = self._create_dummy_sp(add_clean_up=True) |
| 44 | + new_description = data_utils.rand_name('newDescription') |
| 45 | + raw_output = self.openstack('service provider set ' |
| 46 | + '%(service-provider)s ' |
| 47 | + '--description %(description)s ' |
| 48 | + % {'service-provider': service_provider, |
| 49 | + 'description': new_description}) |
| 50 | + self.assertEqual(0, len(raw_output)) |
| 51 | + raw_output = self.openstack('service provider show %s' |
| 52 | + % service_provider) |
| 53 | + updated_value = self.parse_show_as_object(raw_output) |
| 54 | + self.assertIn(new_description, updated_value['description']) |
0 commit comments