Fixes issue #85. Also moves all json imports to go through oauth2client.anyjson. Reviewed in http://codereview.appspot.com/5531064/.
diff --git a/tests/test_json_model.py b/tests/test_json_model.py
index 7ab2f98..43b0421 100644
--- a/tests/test_json_model.py
+++ b/tests/test_json_model.py
@@ -28,9 +28,9 @@
import httplib2
import apiclient.model
-from apiclient.anyjson import simplejson
from apiclient.errors import HttpError
from apiclient.model import JsonModel
+from oauth2client.anyjson import simplejson
FLAGS = gflags.FLAGS
diff --git a/tests/test_oauth2client.py b/tests/test_oauth2client.py
index 8286eed..dfcbf72 100644
--- a/tests/test_oauth2client.py
+++ b/tests/test_oauth2client.py
@@ -33,17 +33,8 @@
except ImportError:
from cgi import parse_qs
-try: # pragma: no cover
- import simplejson
-except ImportError: # pragma: no cover
- try:
- # Try to import from django, should work on App Engine
- from django.utils import simplejson
- except ImportError:
- # Should work for Python2.6 and higher.
- import json as simplejson
-
from apiclient.http import HttpMockSequence
+from oauth2client.anyjson import simplejson
from oauth2client.client import AccessTokenCredentials
from oauth2client.client import AccessTokenCredentialsError
from oauth2client.client import AccessTokenRefreshError
diff --git a/tests/test_oauth2client_appengine.py b/tests/test_oauth2client_appengine.py
index 4ab4f03..f2f470f 100644
--- a/tests/test_oauth2client_appengine.py
+++ b/tests/test_oauth2client_appengine.py
@@ -35,18 +35,18 @@
import dev_appserver
dev_appserver.fix_sys_path()
-from apiclient.anyjson import simplejson
from apiclient.http import HttpMockSequence
from google.appengine.api import apiproxy_stub
from google.appengine.api import apiproxy_stub_map
from google.appengine.api import users
from google.appengine.ext import testbed
from google.appengine.ext import webapp
-from oauth2client.client import AccessTokenRefreshError
-from oauth2client.client import FlowExchangeError
+from oauth2client.anyjson import simplejson
from oauth2client.appengine import AppAssertionCredentials
from oauth2client.appengine import OAuth2Decorator
from oauth2client.appengine import OAuth2Handler
+from oauth2client.client import AccessTokenRefreshError
+from oauth2client.client import FlowExchangeError
from webtest import TestApp
diff --git a/tests/test_oauth2client_file.py b/tests/test_oauth2client_file.py
index 2d6f3b5..a34cce7 100644
--- a/tests/test_oauth2client_file.py
+++ b/tests/test_oauth2client_file.py
@@ -30,24 +30,13 @@
import tempfile
import unittest
-
-try: # pragma: no cover
- import simplejson
-except ImportError: # pragma: no cover
- try:
- # Try to import from django, should work on App Engine
- from django.utils import simplejson
- except ImportError:
- # Should work for Python2.6 and higher.
- import json as simplejson
-
from apiclient.http import HttpMockSequence
-
-from oauth2client.client import OAuth2Credentials
+from oauth2client import multistore_file
+from oauth2client.anyjson import simplejson
from oauth2client.client import AccessTokenCredentials
from oauth2client.client import AssertionCredentials
+from oauth2client.client import OAuth2Credentials
from oauth2client.file import Storage
-from oauth2client import multistore_file
FILENAME = tempfile.mktemp('oauth2client_test.data')
diff --git a/tests/test_oauth2client_jwt.py b/tests/test_oauth2client_jwt.py
index 01a7331..50dab5a 100644
--- a/tests/test_oauth2client_jwt.py
+++ b/tests/test_oauth2client_jwt.py
@@ -34,21 +34,12 @@
except ImportError:
from cgi import parse_qs
-try: # pragma: no cover
- import simplejson
-except ImportError: # pragma: no cover
- try:
- # Try to import from django, should work on App Engine
- from django.utils import simplejson
- except ImportError:
- # Should work for Python2.6 and higher.
- import json as simplejson
-
from apiclient.http import HttpMockSequence
from oauth2client import crypt
+from oauth2client.anyjson import simplejson
from oauth2client.client import SignedJwtAssertionCredentials
-from oauth2client.client import verify_id_token
from oauth2client.client import VerifyJwtTokenError
+from oauth2client.client import verify_id_token
def datafile(filename):
diff --git a/tests/test_schema.py b/tests/test_schema.py
index 7430ac7..2cdb200 100644
--- a/tests/test_schema.py
+++ b/tests/test_schema.py
@@ -20,8 +20,8 @@
import unittest
import StringIO
-from apiclient.anyjson import simplejson
from apiclient.schema import Schemas
+from oauth2client.anyjson import simplejson
DATA_DIR = os.path.join(os.path.dirname(__file__), 'data')
@@ -39,7 +39,7 @@
"anyVal": "", # Anything will do.
"nullVal": None,
"stringVal": "A String",
- "doubleVal": 3.140000,
+ "doubleVal": 3.14,
"booleanVal": True or False, # True or False.
},
],