示例#1
0
文件: tests.py 项目: hartym/wesgi
 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())
示例#2
0
文件: tests.py 项目: hartym/wesgi
 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)
示例#3
0
文件: tests.py 项目: hartym/wesgi
 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)