diff options
Diffstat (limited to 'python2/httplib2test_appengine.py')
-rw-r--r-- | python2/httplib2test_appengine.py | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/python2/httplib2test_appengine.py b/python2/httplib2test_appengine.py index ea36f39..0c0bdc2 100644 --- a/python2/httplib2test_appengine.py +++ b/python2/httplib2test_appengine.py @@ -28,7 +28,7 @@ testbed = testbed.Testbed() testbed.activate() testbed.init_urlfetch_stub() -from google.appengine.runtime import DeadlineExceededError +import google.appengine.api import httplib2 @@ -37,11 +37,6 @@ class AppEngineHttpTest(unittest.TestCase): if os.path.exists(cacheDirName): [os.remove(os.path.join(cacheDirName, file)) for file in os.listdir(cacheDirName)] - if sys.version_info < (2, 6): - disable_cert_validation = True - else: - disable_cert_validation = False - def test(self): h = httplib2.Http() response, content = h.request("http://bitworking.org") @@ -71,12 +66,30 @@ class AppEngineHttpTest(unittest.TestCase): # except DeadlineExceededError: # pass - - def test_proxy_info_ignored(self): h = httplib2.Http(proxy_info='foo.txt') response, content = h.request("http://bitworking.org") self.assertEquals(response.status, 200) + +class AberrationsTest(unittest.TestCase): + def setUp(self): + self.orig_apiproxy_stub_map = google.appengine.api.apiproxy_stub_map + + # Force apiproxy_stub_map to None to trigger the test condition. + google.appengine.api.apiproxy_stub_map = None + reload(httplib2) + + def tearDown(self): + google.appengine.api.apiproxy_stub_map = self.orig_apiproxy_stub_map + reload(httplib2) + + def test(self): + self.assertNotEqual(httplib2.SCHEME_TO_CONNECTION['https'], + httplib2.AppEngineHttpsConnection) + self.assertNotEqual(httplib2.SCHEME_TO_CONNECTION['http'], + httplib2.AppEngineHttpConnection) + + if __name__ == '__main__': unittest.main() |