api: add resources in fillslot_url for meetings datetime response (#43685)

This commit is contained in:
Lauréline Guérin 2020-06-05 15:16:11 +02:00
parent 4ca0af0b54
commit 70f0a0185f
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
2 changed files with 6 additions and 0 deletions

View File

@ -520,6 +520,8 @@ class MeetingDatetimes(APIView):
kwargs={'agenda_identifier': agenda.slug, 'event_identifier': fake_event_identifier,},
)
)
if resources:
fillslot_url += '?resources=%s' % ','.join(r.slug for r in resources)
def make_id(start_datetime, meeting_type):
'''Make virtual id for a slot, combining meeting_type.id and

View File

@ -460,6 +460,8 @@ def test_datetimes_api_meetings_agenda_with_resources(app):
resp = app.get(api_url)
assert len(resp.json['data']) == 32
assert [s['datetime'] for s in resp.json['data'] if s['disabled'] is True] == []
for slot in resp.json['data']:
assert slot['api']['fillslot_url'].endswith('/?resources=%s,%s' % (resource1.slug, resource2.slug))
# resource 1 is not available from 10h to 11h30 in another agenda
dt = make_aware(datetime.datetime.combine(tomorrow, datetime.time(10, 0)))
@ -511,6 +513,8 @@ def test_datetimes_api_meetings_agenda_with_resources(app):
resp = app.get(api_url)
assert len(resp.json['data']) == 32
assert [s['datetime'] for s in resp.json['data'] if s['disabled'] is True] == []
for slot in resp.json['data']:
assert slot['api']['fillslot_url'].endswith('/?resources=%s' % resource2.slug)
# check for resource 3: not available from 9H to 10H
api_url = '/api/agenda/%s/meetings/%s/datetimes/?resources=%s' % (