Projet

Général

Profil

0001-rsa13-add-statut-parameter-to-referent-endpoint-5364.patch

Benjamin Dauvergne, 30 avril 2021 22:45

Télécharger (2,45 ko)

Voir les différences:

Subject: [PATCH] rsa13: add statut parameter to referent endpoint (#53640)

 passerelle/contrib/rsa13/models.py | 13 ++++++++++---
 tests/test_rsa13.py                |  9 +++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)
passerelle/contrib/rsa13/models.py
288 288
                'platform_id': {
289 289
                    'description': _('Platform numeric identifier'),
290 290
                    'example_value': '11',
291
                }
291
                },
292
                'statut': {
293
                    'description': _('Referent status'),
294
                    'example_value': 'Actif',
295
                },
292 296
            }
293 297
        ),
294 298
        display_category=_('Platform'),
......
364 368
            }
365 369
        ),
366 370
    )
367
    def platform_referent(self, request, platform_id, email, ip=None, post_data=None):
371
    def platform_referent(self, request, platform_id, email, ip=None, statut=None, post_data=None):
368 372
        if request.method == 'GET':
369
            return self.get('platform/%s/referent/' % platform_id, email=email, ip=ip)
373
            params = {}
374
            if statut:
375
                params['statut'] = statut
376
            return self.get('platform/%s/referent/' % platform_id, email=email, ip=ip, params=params)
370 377
        else:
371 378
            return self.post('platform/%s/referent/' % platform_id, email=email, ip=ip, json=post_data)
372 379

  
tests/test_rsa13.py
193 193
    }
194 194

  
195 195

  
196
@mock_response(['/api/platform/11/referent/', 'statut=Actif', {'err': 0, 'data': PLATFORM_REFERENT}])
197
def test_platform_referent_with_status(app, rsa13, url):
198
    response = app.get(url + 'platform/11/referent/?statut=Actif')
199
    assert response.json == {
200
        'err': 0,
201
        'data': PLATFORM_REFERENT,
202
    }
203

  
204

  
196 205
@mock_response(['/api/platform/11/referent/', {'err': 0}])
197 206
def test_platform_referent_post(app, rsa13, url):
198 207
    response = app.post_json(
199
-