rsa13: handle clos parameter on platform_beneficiaire_action endpoint (#70247)
This commit is contained in:
parent
6b68a148b4
commit
b062cfd48b
|
@ -1210,6 +1210,10 @@ class RSA13Resource(BaseResource, HTTPResource):
|
|||
'description': _('Beneficiary numeric identifier'),
|
||||
'example_value': '12',
|
||||
},
|
||||
'clos': {
|
||||
'description': _('Filter on closed status'),
|
||||
'example_value': 'non',
|
||||
},
|
||||
}
|
||||
),
|
||||
display_category=_('Platform'),
|
||||
|
@ -1239,11 +1243,14 @@ class RSA13Resource(BaseResource, HTTPResource):
|
|||
}
|
||||
),
|
||||
)
|
||||
def platform_beneficiaire_action(self, request, platform_id, beneficiary_id, email, ip=None):
|
||||
def platform_beneficiaire_action(self, request, platform_id, beneficiary_id, email, ip=None, clos=None):
|
||||
if clos and clos.lower() not in ['oui', 'non']:
|
||||
raise APIError(_('clos must be "oui" or "non"'))
|
||||
return self.get(
|
||||
'platform/%s/beneficiaire/%s/action/' % (platform_id, beneficiary_id),
|
||||
email=email,
|
||||
ip=ip,
|
||||
params={'clos': clos},
|
||||
)
|
||||
|
||||
@endpoint(
|
||||
|
|
|
@ -619,6 +619,17 @@ def test_platform_beneficiaire_action(app, rsa13, url):
|
|||
}
|
||||
|
||||
|
||||
@mock_response(
|
||||
['/api/platform/11/beneficiaire/386981/action/', 'clos=oui', {'err': 0, 'data': BENEFICIAIRE_ACTION}]
|
||||
)
|
||||
def test_platform_beneficiaire_action_clos(app, rsa13, url):
|
||||
response = app.get(url + 'platform/11/beneficiaire/386981/action/', params={'clos': 'oui'})
|
||||
assert response.json == {
|
||||
'err': 0,
|
||||
'data': BENEFICIAIRE_ACTION,
|
||||
}
|
||||
|
||||
|
||||
BENEFICIAIRE_ACTION_DETAIL = {
|
||||
'id': 663774,
|
||||
'contrat_id': 4,
|
||||
|
|
Loading…
Reference in New Issue