(self)
| 420 | self.assertEqual(age, 10) |
| 421 | |
| 422 | def test_custom_expiry_timedelta(self): |
| 423 | modification = timezone.now() |
| 424 | |
| 425 | # Mock timezone.now, because set_expiry calls it on this code path. |
| 426 | original_now = timezone.now |
| 427 | try: |
| 428 | timezone.now = lambda: modification |
| 429 | self.session.set_expiry(timedelta(seconds=10)) |
| 430 | finally: |
| 431 | timezone.now = original_now |
| 432 | |
| 433 | date = self.session.get_expiry_date(modification=modification) |
| 434 | self.assertEqual(date, modification + timedelta(seconds=10)) |
| 435 | |
| 436 | age = self.session.get_expiry_age(modification=modification) |
| 437 | self.assertEqual(age, 10) |
| 438 | |
| 439 | async def test_custom_expiry_timedelta_async(self): |
| 440 | modification = timezone.now() |
nothing calls this directly
no test coverage detected