Esempio n. 1
0
 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)))
Esempio n. 2
0
 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)))
Esempio n. 3
0
 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)))
Esempio n. 4
0
 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)
Esempio n. 5
0
 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)))
Esempio n. 6
0
 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)