tests: add check for timeperiod overlapping current moment

This commit is contained in:
Frédéric Péters 2017-03-26 11:10:23 +02:00
parent 4343b37bb9
commit fe18e6a360
1 changed files with 14 additions and 0 deletions

View File

@ -172,6 +172,20 @@ def test_datetimes_api_meetings_agenda(app, meetings_agenda):
assert resp.json['data'][1] == resp2.json['data'][1]
assert resp.json['data'][3] == resp2.json['data'][2]
# test with a timeperiod overlapping current moment, it should get one
# datetime for the current timeperiod + two from the next week.
TimePeriod.objects.filter(agenda=meetings_agenda).delete()
start_time = now() - datetime.timedelta(minutes=10)
time_period = TimePeriod(agenda=meetings_agenda, weekday=now().weekday(),
start_time=start_time,
end_time=start_time + datetime.timedelta(hours=1))
time_period.save()
meetings_agenda.minimal_booking_delay = 0
meetings_agenda.maximal_booking_delay = 10
meetings_agenda.save()
resp = app.get('/api/agenda/meetings/%s/datetimes/' % meeting_type.id)
assert len(resp.json['data']) == 3
def test_booking_api(app, some_data, user):
agenda = Agenda.objects.filter(label=u'Foo bar')[0]
event = Event.objects.filter(agenda=agenda)[0]