rsa13: add statut parameter to referent endpoint (#53640)
This commit is contained in:
parent
52a932316b
commit
8b1afe9109
|
@ -288,7 +288,11 @@ class RSA13Resource(BaseResource, HTTPResource):
|
|||
'platform_id': {
|
||||
'description': _('Platform numeric identifier'),
|
||||
'example_value': '11',
|
||||
}
|
||||
},
|
||||
'statut': {
|
||||
'description': _('Referent status'),
|
||||
'example_value': 'Actif',
|
||||
},
|
||||
}
|
||||
),
|
||||
display_category=_('Platform'),
|
||||
|
@ -364,9 +368,12 @@ class RSA13Resource(BaseResource, HTTPResource):
|
|||
}
|
||||
),
|
||||
)
|
||||
def platform_referent(self, request, platform_id, email, ip=None, post_data=None):
|
||||
def platform_referent(self, request, platform_id, email, ip=None, statut=None, post_data=None):
|
||||
if request.method == 'GET':
|
||||
return self.get('platform/%s/referent/' % platform_id, email=email, ip=ip)
|
||||
params = {}
|
||||
if statut:
|
||||
params['statut'] = statut
|
||||
return self.get('platform/%s/referent/' % platform_id, email=email, ip=ip, params=params)
|
||||
else:
|
||||
return self.post('platform/%s/referent/' % platform_id, email=email, ip=ip, json=post_data)
|
||||
|
||||
|
|
|
@ -193,6 +193,15 @@ def test_platform_referent(app, rsa13, url):
|
|||
}
|
||||
|
||||
|
||||
@mock_response(['/api/platform/11/referent/', 'statut=Actif', {'err': 0, 'data': PLATFORM_REFERENT}])
|
||||
def test_platform_referent_with_status(app, rsa13, url):
|
||||
response = app.get(url + 'platform/11/referent/?statut=Actif')
|
||||
assert response.json == {
|
||||
'err': 0,
|
||||
'data': PLATFORM_REFERENT,
|
||||
}
|
||||
|
||||
|
||||
@mock_response(['/api/platform/11/referent/', {'err': 0}])
|
||||
def test_platform_referent_post(app, rsa13, url):
|
||||
response = app.post_json(
|
||||
|
|
Loading…
Reference in New Issue