Projet

Général

Profil

0001-api-display-missing-status-as-unknown-44526.patch

Frédéric Péters, 27 juin 2020 16:51

Télécharger (1,71 ko)

Voir les différences:

Subject: [PATCH] api: display missing status as unknown (#44526)

 tests/test_api.py | 8 ++++++++
 wcs/api.py        | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)
tests/test_api.py
2325 2325
    get_app(pub).get(sign_uri('/api/forms/?status=done&limit=plop', user=local_user), status=400)
2326 2326
    get_app(pub).get(sign_uri('/api/forms/?status=done&offset=plop', user=local_user), status=400)
2327 2327

  
2328
    # check when there are missing statuses
2329
    for formdata in data_class.select():
2330
        formdata.status = 'wf-missing'
2331
        formdata.store()
2332
    resp = get_app(pub).get(sign_uri('/api/forms/?status=all', user=local_user))
2333
    assert resp.json['data'][0]['status'] is None
2334
    assert 'unknown' in resp.json['data'][0]['title']
2335

  
2328 2336

  
2329 2337
def test_api_global_listing_ignored_roles(pub, local_user):
2330 2338
    test_api_global_listing(pub, local_user)
wcs/api.py
118 118
        d['title'] = _('%(name)s #%(id)s (%(status)s)') % {
119 119
            'name': formdata.formdef.name,
120 120
            'id': formdata.get_display_id(),
121
            'status': status.name,
121
            'status': status_name or _('unknown'),
122 122
        }
123 123

  
124 124
    d.update(formdata.get_static_substitution_variables(minimal=True))
125
-