Update json module to jsonutils

oslo project provide jsonutils, and senlinclient 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-senlinclient/search?q=jsonutils&unscoped_q=jsonutils

Change-Id: I08efcf3ca8382eab89db4da22821799faf32af59
This commit is contained in:
cao.yuan 2019-02-25 19:15:35 +08:00 committed by caoyuan
parent aeb47baf7d
commit 3425b56057
2 changed files with 5 additions and 7 deletions

View File

@ -10,9 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import yaml
from oslo_serialization import jsonutils
from osc_lib.tests import utils
from senlinclient.common import format_utils
@ -46,7 +47,7 @@ class TestFormats(utils.TestCommand):
def test_json_format(self):
self.cmd = ShowJson(self.app, None)
parsed_args = self.check_parser(self.cmd, [], [])
expected = json.dumps(dict(zip(columns, data)), indent=2)
expected = jsonutils.dumps(dict(zip(columns, data)), indent=2)
self.cmd.run(parsed_args)

View File

@ -12,12 +12,11 @@
import sys
import json
import mock
from osc_lib.tests import utils
import requests
import six
from oslo_serialization import jsonutils
AUTH_TOKEN = "foobar"
AUTH_URL = "http://0.0.0.0"
@ -158,9 +157,7 @@ class FakeResponse(requests.Response):
self.status_code = status_code
self.headers.update(headers)
self._content = json.dumps(data)
if not isinstance(self._content, six.binary_type):
self._content = self._content.encode()
self._content = jsonutils.dump_as_bytes(data)
class FakeClusteringv1Client(object):