diff options
| author | Stephen Finucane <sfinucan@redhat.com> | 2022-11-08 10:49:24 +0000 |
|---|---|---|
| committer | Stephen Finucane <sfinucan@redhat.com> | 2022-11-29 16:21:29 +0000 |
| commit | 686fabef31ee36ec25574ddb086d6e9e3f170045 (patch) | |
| tree | b43d232a0427d19cd913448095b8e4b39d006faa /openstackclient/tests/functional/volume/v1/test_service.py | |
| parent | dc03ce98de3d812b6e62eca233469644689357e0 (diff) | |
| download | python-openstackclient-686fabef31ee36ec25574ddb086d6e9e3f170045.tar.gz | |
tests: Convert volume tests to use 'parse_output'
Change-Id: Iec8ca873f6bc3993e0ba557f68895d9aefb6f9c6
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Diffstat (limited to 'openstackclient/tests/functional/volume/v1/test_service.py')
| -rw-r--r-- | openstackclient/tests/functional/volume/v1/test_service.py | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/openstackclient/tests/functional/volume/v1/test_service.py b/openstackclient/tests/functional/volume/v1/test_service.py index fee73f18..7de2de55 100644 --- a/openstackclient/tests/functional/volume/v1/test_service.py +++ b/openstackclient/tests/functional/volume/v1/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.v1 import common @@ -19,18 +17,18 @@ 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])) # 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], @@ -43,9 +41,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'] @@ -57,9 +56,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'] @@ -77,9 +77,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'] |
