Projet

Général

Profil

0001-api-fix-form-carddata-listing-with-unknown-custom-vi.patch

Lauréline Guérin, 17 mai 2022 16:26

Télécharger (2,16 ko)

Voir les différences:

Subject: [PATCH] api: fix form/carddata listing with unknown custom view
 (#65262)

 tests/api/test_custom_view.py | 8 ++++++++
 wcs/api.py                    | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)
tests/api/test_custom_view.py
179 179

  
180 180
    for i in range(30):
181 181
        formdata = data_class()
182
        formdata.id = 400 + i
182 183
        formdata.data = {'0': 'FOO BAR %d' % i}
183 184
        formdata.user_id = local_user.id
184 185
        formdata.just_created()
......
188 189
            formdata.jump_status('finished')
189 190
        formdata.store()
190 191

  
192
    assert data_class.get(404, ignore_errors=True) is not None
193

  
191 194
    # add proper role to user
192 195
    local_user.roles = [role.id]
193 196
    local_user.store()
......
215 218
    resp = get_app(pub).get(sign_uri('/api/forms/test/custom-view/list/', user=local_user))
216 219
    assert len(resp.json['data']) == 20
217 220

  
221
    resp = get_app(pub).get(sign_uri('/api/forms/test/404/', user=local_user), status=200)
222
    assert resp.json['id'] == '404'
223
    get_app(pub).get(sign_uri('/api/forms/test/list/unknown/', user=local_user), status=404)
224
    get_app(pub).get(sign_uri('/api/forms/test/unknown/list/', user=local_user), status=404)
225

  
218 226

  
219 227
def test_api_ods_formdata_custom_view(pub, local_user):
220 228
    pub.role_class.wipe()
wcs/api.py
251 251
                    self._view = view
252 252
                    break
253 253
                else:
254
                    path = ['404']
254
                    path = ['not-found']
255 255
            path = [path[0]]
256 256

  
257 257
        if len(path) >= 2 and path[1] == 'ics':
258
-