def test_company_is_not_expired(self): """Make sure is_expired properly indicates non-expiration.""" today = datetime.date.today() # Make the company's expiration date weeks in the future: expiration = today + datetime.timedelta(weeks=5) company = Company(name='Test Company', expiration_date=expiration) company.save() self.assertFalse(company.is_expired()) # Move the expiration date to today, which should be the final # non-expired day: expiration = today company.expiration_date = expiration company.save() self.assertFalse(company.is_expired())
def test_company_is_expired(self): """Make sure is_expired properly indicates expiration.""" today = datetime.date.today() # Make the company's expiration in the past: expiration = today - datetime.timedelta(days=1) company = Company(name='Test Company', expiration_date=expiration) company.save() self.assertTrue(company.is_expired())