Update json module to jsonutils

oslo project provide jsonutils, and magnum use it in many place[1],
this PS to update the remained json module to oslo jsonutils for
consistency.

[1]: https://github.com/openstack/magnum/search?utf8=%E2%9C%93&q=jsonutils&type=

Change-Id: I06910797c44c2b1bd2297d4398da9ab984a8f770
This commit is contained in:
jacky06 2019-03-01 00:07:12 +08:00
parent 95520c0447
commit 74a312d6ed
3 changed files with 9 additions and 8 deletions

View File

@ -59,7 +59,7 @@ oslo.context==2.20.0
oslo.i18n==3.20.0
oslo.log==3.37.0
oslo.policy==1.34.0
oslo.serialization==2.25.0
oslo.serialization==2.18.0
oslo.utils==3.36.0
osprofiler==2.3.0
packaging==17.1
@ -80,7 +80,7 @@ python-cinderclient==3.5.0
python-dateutil==2.7.0
python-glanceclient==2.9.1
python-keystoneclient==3.15.0
python-magnumclient==2.6.0
python-magnumclient==2.11.0
python-mimeparse==1.6.0
python-neutronclient==6.7.0
python-novaclient==10.1.0

View File

@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import json
import mock
from oslo_serialization import jsonutils
from magnum_ui.api.rest import magnum
from magnum_ui.test import test_data
from openstack_dashboard.test import helpers as test
@ -42,7 +43,7 @@ class MagnumRestTestCase(test.TestCase):
def test_cluster_template_create(self, client):
test_cluster_templates = mock_resource(TEST.cluster_templates.list())
test_cluster_template = test_cluster_templates[0]
test_body = json.dumps(test_cluster_template.to_dict())
test_body = jsonutils.dumps(test_cluster_template.to_dict())
request = self.mock_rest_request(body=test_body)
client.cluster_template_create.return_value = test_cluster_template
response = magnum.ClusterTemplates().post(request)
@ -83,7 +84,7 @@ class MagnumRestTestCase(test.TestCase):
def test_cluster_create(self, client):
test_clusters = mock_resource(TEST.clusters.list())
test_cluster = test_clusters[0]
test_body = json.dumps(test_cluster.to_dict())
test_body = jsonutils.dumps(test_cluster.to_dict())
request = self.mock_rest_request(body=test_body)
client.cluster_create.return_value = test_cluster
response = magnum.Clusters().post(request)
@ -111,7 +112,7 @@ class MagnumRestTestCase(test.TestCase):
def test_certificate_create(self, client):
test_certificates = mock_resource(TEST.certificates.list())
test_certificate = test_certificates[0]
test_body = json.dumps(test_certificate.to_dict())
test_body = jsonutils.dumps(test_certificate.to_dict())
request = self.mock_rest_request(body=test_body)
test_res_list = mock_resource(TEST.certificate_res_list.list())
@ -119,7 +120,7 @@ class MagnumRestTestCase(test.TestCase):
client.certificate_create.return_value = test_res
response = magnum.Certificates().post(request)
res_body = json.loads(response.content.decode('utf-8'))
res_body = jsonutils.loads(response.content.decode('utf-8'))
self.assertStatusCode(response, 201)
self.assertEqual(res_body['pem'], test_res.to_dict()['pem'])

View File

@ -8,6 +8,6 @@
#
# PBR should always appear first
pbr!=2.1.0,>=2.0.0 # Apache-2.0
python-magnumclient>=2.6.0 # Apache-2.0
python-magnumclient>=2.11.0 # Apache-2.0
horizon>=15.0.0.0b1 # Apache-2.0