def test_empty_headers(self): resp = DummyResponse(headers=idict({})) self.assertEqual(cache.get_max_age(resp,400),60)
def test_plain_max_age(self): resp = DummyResponse(headers=idict({'max-age':'500'})) self.assertEqual(cache.get_max_age(resp,400),500)
def test_bad_max_age(self): resp = DummyResponse(headers=idict({'max-age':'ten'})) self.assertEqual(cache.get_max_age(resp,400),60)
def test_simple_case(self): resp = DummyResponse(headers=idict({'cache-control':'max-age = 300'})) self.assertEqual(cache.get_max_age(resp,400),300)
def test_bad_cache_control(self): resp = DummyResponse(headers=idict({'cache-control':'max-age = fred'})) self.assertEqual(cache.get_max_age(resp,400),60)
def test_empty_headers(self): resp = DummyResponse(headers=idict({})) self.assertEqual(cache.get_max_age(resp, 400), 60)
def test_bad_max_age(self): resp = DummyResponse(headers=idict({'max-age': 'ten'})) self.assertEqual(cache.get_max_age(resp, 400), 60)
def test_plain_max_age(self): resp = DummyResponse(headers=idict({'max-age': '500'})) self.assertEqual(cache.get_max_age(resp, 400), 500)
def test_bad_cache_control(self): resp = DummyResponse( headers=idict({'cache-control': 'max-age = fred'})) self.assertEqual(cache.get_max_age(resp, 400), 60)
def test_simple_case(self): resp = DummyResponse(headers=idict({'cache-control': 'max-age = 300'})) self.assertEqual(cache.get_max_age(resp, 400), 300)