def testDigestAuthStale(self):
# Test that we can handle a nonce becoming stale
uri = urllib.parse.urljoin(base, "digest-expire/file.txt")
self.http.add_credentials('joe', 'password')
(response, content) = self.http.request(uri, "GET", headers = {"cache-control":"no-cache"})
info = httplib2._parse_www_authenticate(response, 'authentication-info')
self.assertEqual(response.status, 200)
time.sleep(3)
# Sleep long enough that the nonce becomes stale
(response, content) = self.http.request(uri, "GET", headers = {"cache-control":"no-cache"})
self.assertFalse(response.fromcache)
self.assertTrue(response._stale_digest)
info3 = httplib2._parse_www_authenticate(response, 'authentication-info')
self.assertEqual(response.status, 200)
评论列表
文章目录