From 7a8ed5e3126b0f1969b93c39b626966731c6e7b5 Mon Sep 17 00:00:00 2001 From: "cao.yuan" Date: Mon, 25 Feb 2019 00:26:24 +0800 Subject: Update json module to jsonutils oslo project provide jsonutils, and keystoneclient use it in many place[1], this PS to update the remained json module to oslo jsonutils for consistency. [1]: https://github.com/openstack/python-keystoneclient/search?utf8=%E2%9C%93&q=jsonutils&type= Change-Id: Id5275b5e6b5bf8f6d54406dac7ab95a30828cf58 --- keystoneclient/tests/unit/v2_0/test_client.py | 11 ++++++----- keystoneclient/tests/unit/v3/test_client.py | 10 +++++----- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'keystoneclient/tests') diff --git a/keystoneclient/tests/unit/v2_0/test_client.py b/keystoneclient/tests/unit/v2_0/test_client.py index cddac4d..7fe9b18 100644 --- a/keystoneclient/tests/unit/v2_0/test_client.py +++ b/keystoneclient/tests/unit/v2_0/test_client.py @@ -10,9 +10,10 @@ # License for the specific language governing permissions and limitations # under the License. -import json import uuid +from oslo_serialization import jsonutils + from keystoneauth1 import fixture from keystoneauth1 import session as auth_session @@ -75,10 +76,10 @@ class KeystoneClientTest(utils.TestCase): password='password', project_name='exampleproject', auth_url=self.TEST_URL) - cache = json.dumps(cl.auth_ref) + cache = jsonutils.dumps(cl.auth_ref) # Creating a HTTPClient not using session is deprecated. with self.deprecations.expect_deprecations_here(): - new_client = client.Client(auth_ref=json.loads(cache)) + new_client = client.Client(auth_ref=jsonutils.loads(cache)) self.assertIsNotNone(new_client.auth_ref) with self.deprecations.expect_deprecations_here(): self.assertTrue(new_client.auth_ref.scoped) @@ -100,11 +101,11 @@ class KeystoneClientTest(utils.TestCase): password='password', project_name='exampleproject', auth_url=self.TEST_URL) - cache = json.dumps(cl.auth_ref) + cache = jsonutils.dumps(cl.auth_ref) new_auth_url = "http://new-public:5000/v2.0" # Creating a HTTPClient not using session is deprecated. with self.deprecations.expect_deprecations_here(): - new_client = client.Client(auth_ref=json.loads(cache), + new_client = client.Client(auth_ref=jsonutils.loads(cache), auth_url=new_auth_url) self.assertIsNotNone(new_client.auth_ref) with self.deprecations.expect_deprecations_here(): diff --git a/keystoneclient/tests/unit/v3/test_client.py b/keystoneclient/tests/unit/v3/test_client.py index feb921a..82088fd 100644 --- a/keystoneclient/tests/unit/v3/test_client.py +++ b/keystoneclient/tests/unit/v3/test_client.py @@ -11,9 +11,9 @@ # under the License. import copy -import json import uuid +from oslo_serialization import jsonutils from keystoneauth1 import session as auth_session from keystoneclient.auth import token_endpoint @@ -90,10 +90,10 @@ class KeystoneClientTest(utils.TestCase): password='password', project_id=token.project_id, auth_url=self.TEST_URL) - cache = json.dumps(c.auth_ref) + cache = jsonutils.dumps(c.auth_ref) # Creating a HTTPClient not using session is deprecated. with self.deprecations.expect_deprecations_here(): - new_client = client.Client(auth_ref=json.loads(cache)) + new_client = client.Client(auth_ref=jsonutils.loads(cache)) self.assertIsNotNone(new_client.auth_ref) self.assertFalse(new_client.auth_ref.domain_scoped) self.assertTrue(new_client.auth_ref.project_scoped) @@ -124,10 +124,10 @@ class KeystoneClientTest(utils.TestCase): password='password', project_id=project_id, auth_url=self.TEST_URL) - cache = json.dumps(c.auth_ref) + cache = jsonutils.dumps(c.auth_ref) # Creating a HTTPClient not using session is deprecated. with self.deprecations.expect_deprecations_here(): - new_client = client.Client(auth_ref=json.loads(cache), + new_client = client.Client(auth_ref=jsonutils.loads(cache), auth_url=new_auth_url) self.assertIsNotNone(new_client.auth_ref) self.assertFalse(new_client.auth_ref.domain_scoped) -- cgit v1.2.1