35 |
35 |
resp = app.get('/api/agenda/%s/datetimes/' % agenda.slug)
|
36 |
36 |
assert len(resp.json['data']) == 0
|
37 |
37 |
check_bookability(resp.json['data'])
|
|
38 |
resp = app.get('/api/agenda/%s/datetimes/' % agenda.slug, params={'bypass_delays': True})
|
|
39 |
assert len(resp.json['data']) == 3
|
38 |
40 |
|
39 |
41 |
agenda.minimal_booking_delay = 2
|
40 |
42 |
agenda.save()
|
41 |
43 |
resp = app.get('/api/agenda/%s/datetimes/' % agenda.slug)
|
42 |
44 |
assert len(resp.json['data']) == 2
|
43 |
45 |
check_bookability(resp.json['data'])
|
|
46 |
resp = app.get('/api/agenda/%s/datetimes/' % agenda.slug, params={'bypass_delays': True})
|
|
47 |
assert len(resp.json['data']) == 3
|
44 |
48 |
|
45 |
49 |
agenda.minimal_booking_delay = 0
|
46 |
50 |
agenda.maximal_booking_delay = 3
|
... | ... | |
49 |
53 |
assert len(resp.json['data']) == 2
|
50 |
54 |
check_bookability(resp.json['data'])
|
51 |
55 |
assert resp.json['data'][0]['description'] is None
|
|
56 |
resp = app.get('/api/agenda/%s/datetimes/' % agenda.slug, params={'bypass_delays': True})
|
|
57 |
assert len(resp.json['data']) == 3
|
52 |
58 |
|
53 |
59 |
agenda.event_set.update(publication_datetime=now() + datetime.timedelta(minutes=1))
|
54 |
60 |
resp = app.get('/api/agenda/%s/datetimes/' % agenda.slug)
|
... | ... | |
685 |
691 |
app.get('/api/agenda/%s/datetimes/' % agenda.slug)
|
686 |
692 |
assert len(ctx.captured_queries) == 5
|
687 |
693 |
|
|
694 |
# check delays
|
|
695 |
resp = app.get('/api/agenda/%s/datetimes/' % agenda.slug)
|
|
696 |
assert len(resp.json['data']) == 4
|
|
697 |
resp = app.get('/api/agenda/%s/datetimes/' % agenda.slug, params={'bypass_delays': True})
|
|
698 |
assert len(resp.json['data']) == 53
|
|
699 |
agenda.minimal_booking_delay = 10
|
|
700 |
agenda.mmaximal_booking_delay = 20
|
|
701 |
agenda.save()
|
|
702 |
resp = app.get('/api/agenda/%s/datetimes/' % agenda.slug)
|
|
703 |
assert len(resp.json['data']) == 3
|
|
704 |
resp = app.get('/api/agenda/%s/datetimes/' % agenda.slug, params={'bypass_delays': True})
|
|
705 |
assert len(resp.json['data']) == 53
|
|
706 |
|
688 |
707 |
|
689 |
708 |
def test_recurring_events_api_various_times(app, user, mock_now):
|
690 |
709 |
agenda = Agenda.objects.create(
|
... | ... | |
1474 |
1493 |
)
|
1475 |
1494 |
assert len(resp.json['data']) == 0
|
1476 |
1495 |
|
|
1496 |
# check delays
|
|
1497 |
Agenda.objects.update(minimal_booking_delay=6, maximal_booking_delay=14)
|
|
1498 |
date_end = localtime() + datetime.timedelta(days=60) # with a date end to have recurring events
|
|
1499 |
resp = app.get('/api/agendas/datetimes/', params={'agendas': agenda_slugs, 'date_end': date_end})
|
|
1500 |
assert len(resp.json['data']) == 2
|
|
1501 |
resp = app.get(
|
|
1502 |
'/api/agendas/datetimes/',
|
|
1503 |
params={'agendas': agenda_slugs, 'date_end': date_end, 'bypass_delays': True},
|
|
1504 |
)
|
|
1505 |
assert len(resp.json['data']) == 5
|
|
1506 |
Agenda.objects.update(minimal_booking_delay=0, maximal_booking_delay=45)
|
|
1507 |
|
1477 |
1508 |
# invalid slugs
|
1478 |
1509 |
resp = app.get('/api/agendas/datetimes/', params={'agendas': 'xxx'}, status=400)
|
1479 |
1510 |
assert resp.json['err_desc'] == 'invalid slugs: xxx'
|
1480 |
|
-
|