def test_cache_expires_set_timedelta(): res = Response() from datetime import timedelta delta = timedelta(seconds=60) res.cache_expires(seconds=delta) assert res.cache_control.max_age == 60
def test_cache_expires_set_zero(): res = Response() res.cache_expires(seconds=0) assert res.cache_control.no_store is True assert res.cache_control.no_cache == '*' assert res.cache_control.must_revalidate is True assert res.cache_control.max_age == 0 assert res.cache_control.post_check == 0
def test_cache_expires_set_zero(): res = Response() res.cache_expires(seconds=0) eq_(res.cache_control.no_store, True) eq_(res.cache_control.no_cache, '*') eq_(res.cache_control.must_revalidate, True) eq_(res.cache_control.max_age, 0) eq_(res.cache_control.post_check, 0)
def test_cache_expires_set_zero_then_nonzero(): res = Response() res.cache_expires(seconds=0) res.cache_expires(seconds=1) assert res.pragma is None assert not res.cache_control.no_cache assert not res.cache_control.no_store assert not res.cache_control.must_revalidate assert res.cache_control.max_age == 1
def test_cache_expires_set_zero_then_nonzero(): res = Response() res.cache_expires(seconds=0) res.cache_expires(seconds=1) eq_(res.pragma, None) ok_(not res.cache_control.no_cache) ok_(not res.cache_control.no_store) ok_(not res.cache_control.must_revalidate) eq_(res.cache_control.max_age, 1)
def test_cache_expires_set(): res = Response() res.cache_expires = True assert ( repr(res.cache_control) == "<CacheControl 'max-age=0, must-revalidate, no-cache, no-store'>" )
def test_cache_expires_set(): res = Response() res.cache_expires = True assert repr(res.cache_control) == "<CacheControl 'max-age=0, must-revalidate, no-cache, no-store'>"
def test_cache_expires_set_None(): res = Response() res.cache_expires(seconds=None, a=1) assert res.cache_control.a == 1
def test_cache_expires_set_int(): res = Response() res.cache_expires(seconds=60) assert res.cache_control.max_age == 60
def test_cache_expires_set_None(): res = Response() res.cache_expires(seconds=None, a=1) eq_(res.cache_control.a, 1)
def test_cache_expires_set_int(): res = Response() res.cache_expires(seconds=60) eq_(res.cache_control.max_age, 60)