Projet

Général

Profil

0001-api-add-category_label-to-agenda-details-65524.patch

Lauréline Guérin, 20 mai 2022 13:55

Télécharger (3,57 ko)

Voir les différences:

Subject: [PATCH] api: add category_label to agenda details (#65524)

 chrono/api/views.py      | 1 +
 tests/api/test_agenda.py | 7 +++++++
 2 files changed, 8 insertions(+)
chrono/api/views.py
363 363
        'edit_role': agenda.edit_role.name if agenda.edit_role else None,
364 364
        'view_role': agenda.view_role.name if agenda.view_role else None,
365 365
        'category': agenda.category.slug if agenda.category else None,
366
        'category_label': agenda.category.label if agenda.category else None,
366 367
    }
367 368

  
368 369
    if agenda.kind == 'meetings':
tests/api/test_agenda.py
76 76
                'edit_role': 'Edit',
77 77
                'view_role': None,
78 78
                'category': 'category-a',
79
                'category_label': 'Category A',
79 80
                'events_type': 'type-a',
80 81
                'absence_reasons': [
81 82
                    {'id': reason.slug, 'slug': reason.slug, 'text': reason.label, 'label': reason.label},
......
101 102
                'edit_role': None,
102 103
                'view_role': None,
103 104
                'category': 'category-a',
105
                'category_label': 'Category A',
104 106
                'events_type': 'type-b',
105 107
                'api': {
106 108
                    'datetimes_url': 'http://testserver/api/agenda/foo-bar-2/datetimes/',
......
119 121
                'edit_role': None,
120 122
                'view_role': None,
121 123
                'category': None,
124
                'category_label': None,
122 125
                'events_type': None,
123 126
                'absence_reasons': [
124 127
                    {'id': reason.slug, 'slug': reason.slug, 'text': reason.label, 'label': reason.label},
......
142 145
                'edit_role': None,
143 146
                'view_role': 'View',
144 147
                'category': 'category-b',
148
                'category_label': 'Category B',
145 149
                'kind': 'meetings',
146 150
                'resources': [
147 151
                    {'id': 'resource-1', 'text': 'Resource 1', 'description': 'Foo bar Resource 1'},
......
164 168
                'edit_role': None,
165 169
                'view_role': None,
166 170
                'category': None,
171
                'category_label': None,
167 172
                'kind': 'meetings',
168 173
                'resources': [],
169 174
                'api': {
......
183 188
                'edit_role': 'Edit',
184 189
                'view_role': 'View',
185 190
                'category': None,
191
                'category_label': None,
186 192
                'kind': 'virtual',
187 193
                'api': {
188 194
                    'meetings_url': 'http://testserver/api/agenda/virtual-agenda/meetings/',
......
429 435
            'edit_role': None,
430 436
            'view_role': None,
431 437
            'category': None,
438
            'category_label': None,
432 439
            'kind': 'virtual',
433 440
            'api': {
434 441
                'meetings_url': 'http://testserver/api/agenda/%s/meetings/' % virtual_meetings_agenda.slug,
435
-