You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

offer_tests.py 689B

12345678910111213141516171819202122
  1. import datetime
  2. from django.test import TestCase
  3. from oscar.apps.offer import models
  4. class TestAConditionalOffer(TestCase):
  5. def test_is_active(self):
  6. start = datetime.date(2011, 01, 01)
  7. test = datetime.date(2011, 01, 10)
  8. end = datetime.date(2011, 02, 01)
  9. offer = models.ConditionalOffer(start_date=start, end_date=end)
  10. self.assertTrue(offer.is_active(test))
  11. def test_is_inactive(self):
  12. start = datetime.date(2011, 01, 01)
  13. test = datetime.date(2011, 03, 10)
  14. end = datetime.date(2011, 02, 01)
  15. offer = models.ConditionalOffer(start_date=start, end_date=end)
  16. self.assertFalse(offer.is_active(test))