def test_cache_for(self): m = cache_for(minutes=5) r = Response() m.modify_response(r) self.assertTrue( compare_datetimes(r.expires, datetime.utcnow() + timedelta(minutes=5)))
def test_two_cache_fors(self): m1 = cache_for(minutes=5) m2 = cache_for(minutes=3) r = Response() m1.modify_response(r) m2.modify_response(r) self.assertTrue(compare_datetimes(r.expires, datetime.utcnow() + timedelta(minutes=3)))
def test_two_cache_fors(self): m1 = cache_for(minutes=5) m2 = cache_for(minutes=3) r = Response() m1.modify_response(r) m2.modify_response(r) self.assertTrue( compare_datetimes(r.expires, datetime.utcnow() + timedelta(minutes=3)))
def test_date_addition(self): r = Response() v.add_date_fields(r) self.assertTrue(compare_datetimes(r.last_modified, datetime.utcnow())) self.assertTrue(compare_datetimes(r.date, datetime.utcnow())) self.assertEquals(r.last_modified, r.date)
def test_cache_for(self): m = cache_for(minutes=5) r = Response() m.modify_response(r) self.assertTrue(compare_datetimes(r.expires, datetime.utcnow() + timedelta(minutes=5)))