0001-rsa13-add-new-params-to-platform_beneficiaire_csv-en.patch
passerelle/contrib/rsa13/models.py | ||
---|---|---|
612 | 612 |
ip=None, |
613 | 613 |
page=None, |
614 | 614 |
query=None, |
615 |
nom=None, |
|
616 |
prenom=None, |
|
617 |
matricule=None, |
|
618 |
referent=None, |
|
615 | 619 |
): |
616 | 620 |
params = {} |
617 | 621 |
if query: |
618 | 622 |
params['query'] = query |
623 |
if query == '0': |
|
624 |
for key in ['nom', 'prenom', 'matricule', 'referent']: |
|
625 |
if locals().get(key): |
|
626 |
params[key] = locals()[key] |
|
619 | 627 |
content = self.get('platform/%s/beneficiaire/csv/' % platform_id, email=email, ip=ip, params=params) |
620 | 628 |
data = content['data'] |
621 | 629 |
tests/test_rsa13.py | ||
---|---|---|
60 | 60 |
path, content = row |
61 | 61 |
query = None |
62 | 62 | |
63 |
def make_handler(path, content): |
|
63 |
def make_handler(path, query, content):
|
|
64 | 64 |
@httmock.urlmatch(path=path) |
65 | 65 |
def handler(url, request): |
66 | 66 |
if query: |
... | ... | |
69 | 69 | |
70 | 70 |
return handler |
71 | 71 | |
72 |
handlers.append(make_handler(path, content)) |
|
72 |
handlers.append(make_handler(path, query, content))
|
|
73 | 73 |
handlers.append(error) |
74 | 74 | |
75 | 75 |
with httmock.HTTMock(*handlers): |
... | ... | |
327 | 327 | |
328 | 328 | |
329 | 329 |
@mock_response( |
330 |
[ |
|
331 |
'/api/platform/12/beneficiaire/csv/', |
|
332 |
'query=0&nom=bar&prenom=foo&matricule=xxx', |
|
333 |
{'err': 0, 'data': [BENEFICIAIRE_CSV]}, |
|
334 |
], |
|
330 | 335 |
[ |
331 | 336 |
'/api/platform/11/beneficiaire/csv/', |
332 | 337 |
'query=1', |
... | ... | |
344 | 349 |
response.content |
345 | 350 |
== b'''\xef\xbb\xbfNUM_CAF;CODE_PER;NOM_PER;PRENOM_PER;DTNAI_PER;ACTIF_PER;CODE_PI;LIB_CODE_PI;TOPPERSDRODEVORSA;LIB_ETATDOSRSA;LIB_MOTIF_ETATDOSRSA;NB_JOUR_DEPUIS_ARR;DATE_DEB;DATE_1IERE_CONS;DATE_DERNIERE_CONSULT;DATE_REELLE_RDV;NUM_CINS;DATE_SIGN;DATE_DEB_CI;DATE_FIN_CI;REFERENT_CI;ACTION_EN_COURS;DELAI_REGUL;PROC_EN_COURS;REFERENT_AFFECTATION\r\n1234;1234;nom;prenom;1234;1234;;;;;;;;;;;;;;;;;;;\r\n''' # NOQA E501 |
346 | 351 |
) |
352 |
response = app.get( |
|
353 |
url + 'platform/12/beneficiaire/csv/', |
|
354 |
params={'query': '0', 'prenom': 'foo', 'nom': 'bar', 'matricule': 'xxx', 'referent': ''}, |
|
355 |
) |
|
347 | 356 | |
348 | 357 | |
349 | 358 |
BENEFICIAIRE_DETAIL = { |
350 |
- |