diff options
Diffstat (limited to 'python2/httplib2test.py')
-rwxr-xr-x | python2/httplib2test.py | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/python2/httplib2test.py b/python2/httplib2test.py index 104eaf7..d9bfdb6 100755 --- a/python2/httplib2test.py +++ b/python2/httplib2test.py @@ -531,12 +531,14 @@ class HttpTest(unittest.TestCase): http.request, "https://www.google.com/", "GET") def testSslCertValidationDoubleDots(self): - if sys.version_info >= (2, 6): - # Test that we get match a double dot cert - try: - self.http.request("https://1.www.appspot.com/", "GET") - except httplib2.CertificateHostnameMismatch: - self.fail('cert with *.*.appspot.com should not raise an exception.') + pass + # No longer a valid test. + #if sys.version_info >= (2, 6): + # Test that we get match a double dot cert + #try: + # self.http.request("https://www.appspot.com/", "GET") + #except httplib2.CertificateHostnameMismatch: + # self.fail('cert with *.*.appspot.com should not raise an exception.') def testSslHostnameValidation(self): pass @@ -625,7 +627,7 @@ class HttpTest(unittest.TestCase): def testGet304(self): # Test that we use ETags properly to validate our cache uri = urlparse.urljoin(base, "304/test_etag.txt") - (response, content) = self.http.request(uri, "GET") + (response, content) = self.http.request(uri, "GET", headers= {'accept-encoding': 'identity'}) self.assertNotEqual(response['etag'], "") (response, content) = self.http.request(uri, "GET") @@ -651,15 +653,15 @@ class HttpTest(unittest.TestCase): def testGetIgnoreEtag(self): # Test that we can forcibly ignore ETags uri = urlparse.urljoin(base, "reflector/reflector.cgi") - (response, content) = self.http.request(uri, "GET") + (response, content) = self.http.request(uri, "GET", headers= {'accept-encoding': 'identity'}) self.assertNotEqual(response['etag'], "") - (response, content) = self.http.request(uri, "GET", headers = {'cache-control': 'max-age=0'}) + (response, content) = self.http.request(uri, "GET", headers = {'accept-encoding': 'identity', 'cache-control': 'max-age=0'}) d = self.reflector(content) self.assertTrue(d.has_key('HTTP_IF_NONE_MATCH')) self.http.ignore_etag = True - (response, content) = self.http.request(uri, "GET", headers = {'cache-control': 'max-age=0'}) + (response, content) = self.http.request(uri, "GET", headers = {'accept-encoding': 'identity', 'cache-control': 'max-age=0'}) d = self.reflector(content) self.assertEqual(response.fromcache, False) self.assertFalse(d.has_key('HTTP_IF_NONE_MATCH')) @@ -667,15 +669,15 @@ class HttpTest(unittest.TestCase): def testOverrideEtag(self): # Test that we can forcibly ignore ETags uri = urlparse.urljoin(base, "reflector/reflector.cgi") - (response, content) = self.http.request(uri, "GET") + (response, content) = self.http.request(uri, "GET", headers= {'accept-encoding': 'identity'}) self.assertNotEqual(response['etag'], "") - (response, content) = self.http.request(uri, "GET", headers = {'cache-control': 'max-age=0'}) + (response, content) = self.http.request(uri, "GET", headers = {'accept-encoding': 'identity', 'cache-control': 'max-age=0'}) d = self.reflector(content) self.assertTrue(d.has_key('HTTP_IF_NONE_MATCH')) self.assertNotEqual(d['HTTP_IF_NONE_MATCH'], "fred") - (response, content) = self.http.request(uri, "GET", headers = {'cache-control': 'max-age=0', 'if-none-match': 'fred'}) + (response, content) = self.http.request(uri, "GET", headers = {'accept-encoding': 'identity', 'cache-control': 'max-age=0', 'if-none-match': 'fred'}) d = self.reflector(content) self.assertTrue(d.has_key('HTTP_IF_NONE_MATCH')) self.assertEqual(d['HTTP_IF_NONE_MATCH'], "fred") @@ -929,26 +931,26 @@ class HttpTest(unittest.TestCase): def testGetCacheControlNoCache(self): # Test Cache-Control: no-cache on requests uri = urlparse.urljoin(base, "304/test_etag.txt") - (response, content) = self.http.request(uri, "GET") + (response, content) = self.http.request(uri, "GET", headers= {'accept-encoding': 'identity'}) self.assertNotEqual(response['etag'], "") - (response, content) = self.http.request(uri, "GET") + (response, content) = self.http.request(uri, "GET", headers= {'accept-encoding': 'identity'}) self.assertEqual(response.status, 200) self.assertEqual(response.fromcache, True) - (response, content) = self.http.request(uri, "GET", headers={'Cache-Control': 'no-cache'}) + (response, content) = self.http.request(uri, "GET", headers={'accept-encoding': 'identity', 'Cache-Control': 'no-cache'}) self.assertEqual(response.status, 200) self.assertEqual(response.fromcache, False) def testGetCacheControlPragmaNoCache(self): # Test Pragma: no-cache on requests uri = urlparse.urljoin(base, "304/test_etag.txt") - (response, content) = self.http.request(uri, "GET") + (response, content) = self.http.request(uri, "GET", headers= {'accept-encoding': 'identity'}) self.assertNotEqual(response['etag'], "") - (response, content) = self.http.request(uri, "GET") + (response, content) = self.http.request(uri, "GET", headers= {'accept-encoding': 'identity'}) self.assertEqual(response.status, 200) self.assertEqual(response.fromcache, True) - (response, content) = self.http.request(uri, "GET", headers={'Pragma': 'no-cache'}) + (response, content) = self.http.request(uri, "GET", headers={'accept-encoding': 'identity', 'Pragma': 'no-cache'}) self.assertEqual(response.status, 200) self.assertEqual(response.fromcache, False) |