Example #1
0
 def test_https(self):
     from wesgi import Policy
     policy = Policy()
     policy.chase_redirect = True
     http = policy.http()
     result, content = http.request('https://encrypted.google.com/')
     self.assertTrue("google" in content.lower())
Example #2
0
 def test_chase_redirect(self):
     from wesgi import Policy
     policy = Policy()
     self.assertEquals(policy.http().follow_redirects, False)
     # unless it's specified in the policy
     policy = Policy()
     policy.chase_redirect = True
     self.assertEquals(policy.http().follow_redirects, True)
Example #3
0
 def test_cached_http(self):
     from wesgi import LRUCache
     from wesgi import Policy
     policy = Policy()
     policy.cache = LRUCache()
     policy.chase_redirect = True
     http = policy.http()
     self.assertEquals(0, policy.cache.hits + policy.cache.misses)
     result, content = http.request('http://www.google.com/')
     self.assertTrue("google" in content.lower())
     self.assertFalse(result.fromcache)
     self.assertNotEquals(0, policy.cache.hits + policy.cache.misses)
     result, content = http.request('http://www.google.com/')
     self.assertTrue("google" in content.lower())
     self.assertNotEquals(0, policy.cache.hits + policy.cache.misses)