MCPcopy Create free account
hub / github.com/psf/cachecontrol / TestPermanentRedirects

Class TestPermanentRedirects

tests/test_redirects.py:14–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12
13
14class TestPermanentRedirects:
15 def setup_method(self):
16 self.sess = CacheControl(requests.Session())
17
18 def test_redirect_response_is_cached(self, url):
19 self.sess.get(url + "permanent_redirect", allow_redirects=False)
20
21 resp = self.sess.get(url + "permanent_redirect", allow_redirects=False)
22 assert resp.from_cache
23
24 def test_bust_cache_on_redirect(self, url):
25 self.sess.get(url + "permanent_redirect", allow_redirects=False)
26
27 resp = self.sess.get(
28 url + "permanent_redirect",
29 headers={"cache-control": "no-cache"},
30 allow_redirects=False,
31 )
32 assert not resp.from_cache
33
34
35class TestMultipleChoicesRedirects:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…