Exemple #1
0
	def test_has_passed_with_future_event(self):
		"""
		should return false for events in the future
		"""
		time = timezone.now() + datetime.timedelta(days=10)
		future_event = Event(starts_at=time)
		self.assertEqual(future_event.has_passed(), False)
Exemple #2
0
class EventHasPassedTestCase(unittest.TestCase):
    def setUp(self):
        self.event = Event("Name", "name", "Location", EventType("Type"),
                        starts = datetime(2009, 1, 6, 12, 0),
                        ends = datetime(2009, 1, 6, 12, 42),
                        registration_starts = datetime(2009, 1, 6, 11, 30),
                        registration_limit = 0)

    def test_has_not_passed(self):
        now = datetime(2009,1,6, 12,30)
        self.assertEqual(self.event.has_passed(now), False)

    def test_has_not_passed_last_minute(self):
        now = datetime(2009,1,6, 12,42)

        self.assertEqual(self.event.has_passed(now), False)

    def test_has_passed(self):
        now = datetime(2009,1,6, 12,50)
        self.assertEqual(self.event.has_passed(now), True)