diff options
| author | Zuul <zuul@review.opendev.org> | 2022-12-02 14:21:43 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2022-12-02 14:21:43 +0000 |
| commit | a5f207b657fd008fc976f8f553dd579eafef62e5 (patch) | |
| tree | 9355ee6462a18bc38af9109fd52f873693eff330 /openstackclient/tests/functional/volume/v2/test_service.py | |
| parent | 5aecefe911874519a27ef2fd5903bad792d13c2b (diff) | |
| parent | 686fabef31ee36ec25574ddb086d6e9e3f170045 (diff) | |
| download | python-openstackclient-a5f207b657fd008fc976f8f553dd579eafef62e5.tar.gz | |
Merge "tests: Convert volume tests to use 'parse_output'"
Diffstat (limited to 'openstackclient/tests/functional/volume/v2/test_service.py')
| -rw-r--r-- | openstackclient/tests/functional/volume/v2/test_service.py | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/openstackclient/tests/functional/volume/v2/test_service.py b/openstackclient/tests/functional/volume/v2/test_service.py index 7ec43fe8..5794f81f 100644 --- a/openstackclient/tests/functional/volume/v2/test_service.py +++ b/openstackclient/tests/functional/volume/v2/test_service.py @@ -10,8 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -import json - from openstackclient.tests.functional.volume.v2 import common @@ -19,19 +17,19 @@ class VolumeServiceTests(common.BaseVolumeTests): """Functional tests for volume service.""" def test_volume_service_list(self): - cmd_output = json.loads(self.openstack( - 'volume service list -f json')) + cmd_output = self.openstack('volume service list', parse_output=True) # Get the nonredundant services and hosts services = list(set([x['Binary'] for x in cmd_output])) hosts = list(set([x['Host'] for x in cmd_output])) # Test volume service list --service - cmd_output = json.loads(self.openstack( - 'volume service list -f json ' + + cmd_output = self.openstack( + 'volume service list ' + '--service ' + - services[0] - )) + services[0], + parse_output=True, + ) for x in cmd_output: self.assertEqual( services[0], @@ -39,11 +37,12 @@ class VolumeServiceTests(common.BaseVolumeTests): ) # Test volume service list --host - cmd_output = json.loads(self.openstack( - 'volume service list -f json ' + + cmd_output = self.openstack( + 'volume service list ' + '--host ' + - hosts[0] - )) + hosts[0], + parse_output=True, + ) for x in cmd_output: self.assertIn( hosts[0], @@ -53,9 +52,10 @@ class VolumeServiceTests(common.BaseVolumeTests): def test_volume_service_set(self): # Get a service and host - cmd_output = json.loads(self.openstack( - 'volume service list -f json' - )) + cmd_output = self.openstack( + 'volume service list', + parse_output=True, + ) service_1 = cmd_output[0]['Binary'] host_1 = cmd_output[0]['Host'] @@ -67,9 +67,10 @@ class VolumeServiceTests(common.BaseVolumeTests): ) self.assertOutput('', raw_output) - cmd_output = json.loads(self.openstack( - 'volume service list -f json --long' - )) + cmd_output = self.openstack( + 'volume service list --long', + parse_output=True, + ) self.assertEqual( 'enabled', cmd_output[0]['Status'] @@ -89,9 +90,10 @@ class VolumeServiceTests(common.BaseVolumeTests): ) self.assertOutput('', raw_output) - cmd_output = json.loads(self.openstack( - 'volume service list -f json --long' - )) + cmd_output = self.openstack( + 'volume service list --long', + parse_output=True, + ) self.assertEqual( 'disabled', cmd_output[0]['Status'] |
