summaryrefslogtreecommitdiff
path: root/openstackclient/tests/functional/volume/base.py
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-12-02 14:21:43 +0000
committerGerrit Code Review <review@openstack.org>2022-12-02 14:21:43 +0000
commita5f207b657fd008fc976f8f553dd579eafef62e5 (patch)
tree9355ee6462a18bc38af9109fd52f873693eff330 /openstackclient/tests/functional/volume/base.py
parent5aecefe911874519a27ef2fd5903bad792d13c2b (diff)
parent686fabef31ee36ec25574ddb086d6e9e3f170045 (diff)
downloadpython-openstackclient-a5f207b657fd008fc976f8f553dd579eafef62e5.tar.gz
Merge "tests: Convert volume tests to use 'parse_output'"
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))