api: add category_label to agenda details (#65524)

This commit is contained in:
Lauréline Guérin 2022-05-20 13:54:14 +02:00
parent 0bceea5cad
commit de59c38321
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
2 changed files with 8 additions and 0 deletions

View File

@ -363,6 +363,7 @@ def get_agenda_detail(request, agenda, check_events=False):
'edit_role': agenda.edit_role.name if agenda.edit_role else None,
'view_role': agenda.view_role.name if agenda.view_role else None,
'category': agenda.category.slug if agenda.category else None,
'category_label': agenda.category.label if agenda.category else None,
}
if agenda.kind == 'meetings':

View File

@ -76,6 +76,7 @@ def test_agendas_api(app):
'edit_role': 'Edit',
'view_role': None,
'category': 'category-a',
'category_label': 'Category A',
'events_type': 'type-a',
'absence_reasons': [
{'id': reason.slug, 'slug': reason.slug, 'text': reason.label, 'label': reason.label},
@ -101,6 +102,7 @@ def test_agendas_api(app):
'edit_role': None,
'view_role': None,
'category': 'category-a',
'category_label': 'Category A',
'events_type': 'type-b',
'api': {
'datetimes_url': 'http://testserver/api/agenda/foo-bar-2/datetimes/',
@ -119,6 +121,7 @@ def test_agendas_api(app):
'edit_role': None,
'view_role': None,
'category': None,
'category_label': None,
'events_type': None,
'absence_reasons': [
{'id': reason.slug, 'slug': reason.slug, 'text': reason.label, 'label': reason.label},
@ -142,6 +145,7 @@ def test_agendas_api(app):
'edit_role': None,
'view_role': 'View',
'category': 'category-b',
'category_label': 'Category B',
'kind': 'meetings',
'resources': [
{'id': 'resource-1', 'text': 'Resource 1', 'description': 'Foo bar Resource 1'},
@ -164,6 +168,7 @@ def test_agendas_api(app):
'edit_role': None,
'view_role': None,
'category': None,
'category_label': None,
'kind': 'meetings',
'resources': [],
'api': {
@ -183,6 +188,7 @@ def test_agendas_api(app):
'edit_role': 'Edit',
'view_role': 'View',
'category': None,
'category_label': None,
'kind': 'virtual',
'api': {
'meetings_url': 'http://testserver/api/agenda/virtual-agenda/meetings/',
@ -429,6 +435,7 @@ def test_virtual_agenda_detail(app, virtual_meetings_agenda):
'edit_role': None,
'view_role': None,
'category': None,
'category_label': None,
'kind': 'virtual',
'api': {
'meetings_url': 'http://testserver/api/agenda/%s/meetings/' % virtual_meetings_agenda.slug,