Switch all uses of json to oslo_serialization

This commit migrates all the usage of the json library to use jsonutils
from oslo_serialization. On python 3 httplib2 returns a bytes type for
the response body however all the methods in the json library are
expecting str types. We could switch all the uses of json.loads to
encode the input prior to calling json.loads however oslo_serialization
has baked in all dual python version edge conditions around this into
a call compatible lib which is much cleaner.

Change-Id: Icee30fb74db128c77b2c0c27e68b5801bd138cd5
This commit is contained in:
Matthew Treinish 2015-07-13 10:33:35 -04:00
parent e083f64669
commit 2190551738
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
62 changed files with 63 additions and 82 deletions

View File

@ -13,8 +13,8 @@
# under the License.
import hashlib
import json
from oslo_serialization import jsonutils as json
from tempest_lib import exceptions as lib_exc
from tempest.api.object_storage import base

View File

@ -51,10 +51,10 @@ deleted and the admin user specified in tempest.conf is never deleted.
Please run with **--help** to see full list of options.
"""
import argparse
import json
import sys
from oslo_log import log as logging
from oslo_serialization import jsonutils as json
from tempest import clients
from tempest.cmd import cleanup_service

View File

@ -16,7 +16,6 @@
import argparse
import inspect
import json
import sys
try:
from unittest import loader
@ -25,6 +24,7 @@ except ImportError:
from unittest2 import loader
from oslo_log import log as logging
from oslo_serialization import jsonutils as json
from testtools import testsuite
from tempest.stress import driver

View File

@ -15,11 +15,11 @@
# under the License.
import argparse
import json
import os
import sys
import httplib2
from oslo_serialization import jsonutils as json
from six import moves
from six.moves.urllib import parse as urlparse

View File

@ -17,7 +17,6 @@
import copy
import hashlib
import json
import posixpath
import re
import socket
@ -25,6 +24,7 @@ import struct
import OpenSSL
from oslo_log import log as logging
from oslo_serialization import jsonutils as json
import six
from six import moves
from six.moves import http_client as httplib

View File

@ -13,11 +13,11 @@
# under the License.
import json
import re
import string
import unicodedata
from oslo_serialization import jsonutils as json
from tempest_lib.common.utils import misc
import testscenarios
import testtools

View File

@ -11,8 +11,8 @@
# under the License.
import functools
import json
from oslo_serialization import jsonutils as json
import six
from six.moves.urllib import parse as urllib

View File

@ -12,8 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.api_schema.response.compute.v2_1 import agents as schema

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest_lib import exceptions as lib_exc
from tempest.api_schema.response.compute.v2_1 import aggregates as schema

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1 import availability_zone \
as schema

View File

@ -12,8 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.api_schema.response.compute.v2_1 import baremetal_nodes \

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1 import certificates as schema
from tempest.common import service_client

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1 import extensions as schema
from tempest.common import service_client

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1 import fixed_ips as schema
from tempest.common import service_client

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.api_schema.response.compute.v2_1 import flavors as schema

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc

View File

@ -12,8 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.api_schema.response.compute.v2_1 import hosts as schema

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1 import hypervisors as schema
from tempest.common import service_client

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1 import \
instance_usage_audit_logs as schema

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1 import interfaces as schema
from tempest.api_schema.response.compute.v2_1 import servers as servers_schema

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1 import keypairs as schema
from tempest.common import service_client

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1 import limits as schema
from tempest.common import service_client

View File

@ -12,8 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.api_schema.response.compute.v2_1 import migrations as schema

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.common import service_client

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1\
import quota_classes as classes_schema

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1 import quotas as schema
from tempest.common import service_client

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1 import \
security_group_default_rule as schema

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc

View File

@ -14,9 +14,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import time
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc

View File

@ -14,8 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.api_schema.response.compute.v2_1 import services as schema

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1 import tenant_networks as schema
from tempest.common import service_client

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.api_schema.response.compute.v2_1 import tenant_usages as schema

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.common import service_client

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest_lib import exceptions as lib_exc
from tempest.common import service_client

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.common import service_client

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.common import service_client

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.common import service_client

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.common import service_client

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.common import service_client

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.common import service_client

View File

@ -15,11 +15,11 @@
import copy
import errno
import json
import os
import time
from oslo_log import log as logging
from oslo_serialization import jsonutils as json
import six
from six.moves.urllib import parse as urllib
from tempest_lib.common.utils import misc as misc_utils

View File

@ -13,9 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import jsonschema
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc

View File

@ -13,9 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import json
import uuid
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.api_schema.response.messaging.v1 import queues as queues_schema

View File

@ -10,9 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import time
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib.common.utils import misc
from tempest_lib import exceptions as lib_exc

View File

@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from xml.etree import ElementTree as etree
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.common import service_client

View File

@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from xml.etree import ElementTree as etree
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.common import service_client

View File

@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import re
import time
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.common import service_client

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.common import service_client

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.common import service_client

View File

@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import time
from oslo_serialization import jsonutils as json
from tempest.common import service_client
from tempest import exceptions

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
from tempest.common import service_client

View File

@ -12,9 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import time
from oslo_serialization import jsonutils as json
from tempest_lib import exceptions as lib_exc
from tempest.common import service_client

View File

@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import time
from oslo_log import log as logging
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from oslo_serialization import jsonutils as json
import six
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc

View File

@ -15,7 +15,6 @@
import atexit
import functools
import json
import os
import re
import sys
@ -25,6 +24,7 @@ import uuid
import fixtures
from oslo_log import log as logging
from oslo_serialization import jsonutils as json
from oslo_utils import importutils
import six
import testscenarios

View File

@ -12,9 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import mock
from oslo_serialization import jsonutils as json
from oslotest import mockpatch
from tempest.cmd import verify_tempest_config

View File

@ -13,9 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import httplib2
from oslo_serialization import jsonutils as json
FAKE_AUTH_URL = 'http://fake_uri.com/auth'

View File

@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import socket
import mock
from oslo_serialization import jsonutils as json
from oslotest import mockpatch
import six
from six.moves import http_client as httplib