fix date tests
Previously, if tests where ran around midnight, a talk starting in a day and ending in another one would have been created, and this is not currently handleable
This commit is contained in:
parent
0a8ec84b0b
commit
45facae55c
11
cfp/tests.py
11
cfp/tests.py
|
@ -586,23 +586,26 @@ class StaffTest(TestCase):
|
|||
conf = Conference.objects.get(name='PonyConf')
|
||||
talk = Talk.objects.get(title='Talk 1')
|
||||
talk.room = Room.objects.filter(site=conf.site).first()
|
||||
talk.start_date = timezone.now()
|
||||
now = timezone.now()
|
||||
if now.hour > 22:
|
||||
now -= timedelta(hours=1)
|
||||
talk.start_date = now
|
||||
talk.duration = 60
|
||||
talk.accepted = True
|
||||
talk.video = 'this-is-a-video-location'
|
||||
talk.save()
|
||||
xml_url = reverse('public-schedule') + 'xml/'
|
||||
conf.schedule_publishing_date = timezone.now() - timedelta(hours=1)
|
||||
conf.schedule_publishing_date = now - timedelta(hours=1)
|
||||
conf.video_publishing_date = None
|
||||
conf.save()
|
||||
self.assertContains(self.client.get(xml_url), 'Talk 1')
|
||||
self.assertFalse(conf.videos_available)
|
||||
self.assertNotContains(self.client.get(xml_url), talk.video)
|
||||
conf.video_publishing_date = timezone.now() + timedelta(hours=1)
|
||||
conf.video_publishing_date = now + timedelta(hours=2)
|
||||
conf.save()
|
||||
self.assertFalse(conf.videos_available)
|
||||
self.assertNotContains(self.client.get(xml_url), talk.video)
|
||||
conf.video_publishing_date = timezone.now() - timedelta(hours=1)
|
||||
conf.video_publishing_date = now - timedelta(hours=1)
|
||||
conf.save()
|
||||
self.assertTrue(conf.videos_available)
|
||||
self.assertContains(self.client.get(xml_url), talk.video)
|
||||
|
|
Loading…
Reference in New Issue