Switch from json.loads to yaml.safe_load for decoded usernames

In the rotate password test, the results from the action return a list
of strings that are deliminted by single quotes.  This isn't compatible
with json.loads(), but yaml.safe_load() is able to load the string as an
array of strings.
This commit is contained in:
Alex Kavanagh
2023-05-05 09:07:14 +02:00
parent ce2b26a6e0
commit 0fe8e9d666

View File

@@ -21,6 +21,7 @@ import os
import re
import tempfile
import tenacity
import yaml
import zaza.charm_lifecycle.utils as lifecycle_utils
import zaza.model
@@ -615,7 +616,7 @@ class MySQLInnoDBClusterRotatePasswordTests(MySQLCommonTests):
'list-service-usernames',
action_params={}
)
usernames = json.loads(action.data['results']['usernames'])
usernames = yaml.safe_load(action.data['results']['usernames'])
logging.info("... usernames: %s", ', '.join(usernames))
self.assertIn('keystone', usernames)