summaryrefslogtreecommitdiff
path: root/openstackclient/tests/functional/volume/base.py
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2022-11-08 10:49:24 +0000
committerStephen Finucane <sfinucan@redhat.com>2022-11-29 16:21:29 +0000
commit686fabef31ee36ec25574ddb086d6e9e3f170045 (patch)
treeb43d232a0427d19cd913448095b8e4b39d006faa /openstackclient/tests/functional/volume/base.py
parentdc03ce98de3d812b6e62eca233469644689357e0 (diff)
downloadpython-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/base.py')
-rw-r--r--openstackclient/tests/functional/volume/base.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/openstackclient/tests/functional/volume/base.py b/openstackclient/tests/functional/volume/base.py
index 53032606..041d8d07 100644
--- a/openstackclient/tests/functional/volume/base.py
+++ b/openstackclient/tests/functional/volume/base.py
@@ -10,7 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import json
import time
from openstackclient.tests.functional import base
@@ -27,10 +26,12 @@ class BaseVolumeTests(base.TestCase):
failures = ['error']
total_sleep = 0
while total_sleep < wait:
- output = json.loads(cls.openstack(
- check_type + ' show -f json ' + check_name))
+ output = cls.openstack(
+ check_type + ' show ' + check_name,
+ parse_output=True,
+ )
current_status = output['status']
- if (current_status == desired_status):
+ if current_status == desired_status:
print('{} {} now has status {}'
.format(check_type, check_name, current_status))
return
@@ -51,7 +52,7 @@ class BaseVolumeTests(base.TestCase):
total_sleep = 0
name_field = name_field or 'Name'
while total_sleep < wait:
- result = json.loads(cls.openstack(check_type + ' list -f json'))
+ result = cls.openstack(check_type + ' list', parse_output=True)
names = [x[name_field] for x in result]
if check_name not in names:
print('{} {} is now deleted'.format(check_type, check_name))