Stage 1 conversion to JSON for storing Credentials.

Reviewed in http://codereview.appspot.com/4972065/
diff --git a/tests/test_oauth2client.py b/tests/test_oauth2client.py
index de11810..14beb97 100644
--- a/tests/test_oauth2client.py
+++ b/tests/test_oauth2client.py
@@ -22,6 +22,7 @@
 
 __author__ = 'jcgregorio@google.com (Joe Gregorio)'
 
+import datetime
 import httplib2
 import unittest
 import urlparse
@@ -31,6 +32,16 @@
 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.client import AccessTokenCredentials
 from oauth2client.client import AccessTokenCredentialsError
@@ -48,7 +59,7 @@
     client_id = "some_client_id"
     client_secret = "cOuDdkfjxxnv+"
     refresh_token = "1/0/a.df219fjls0"
-    token_expiry = "ignored"
+    token_expiry = datetime.datetime.utcnow()
     token_uri = "https://www.google.com/accounts/o8/oauth2/token"
     user_agent = "refresh_checker/1.0"
     self.credentials = OAuth2Credentials(
@@ -86,6 +97,12 @@
     resp, content = http.request("http://example.com")
     self.assertEqual(400, resp.status)
 
+  def test_to_from_json(self):
+    json = self.credentials.to_json()
+    instance = OAuth2Credentials.from_json(json)
+    self.assertEquals(type(instance), OAuth2Credentials)
+    self.assertEquals(self.credentials.__dict__, instance.__dict__)
+
 
 class AccessTokenCredentialsTests(unittest.TestCase):