api_entreprise: use v3 in associations endpoint (#70610)
This commit is contained in:
parent
4df3791e52
commit
35df56d019
|
@ -306,7 +306,11 @@ class APIEntreprise(BaseResource):
|
|||
},
|
||||
)
|
||||
def associations(self, request, association_id, **kwargs):
|
||||
return self.get('v2/associations/%s/' % association_id, **kwargs)
|
||||
raw_data = self.get('v3/ministere_interieur/rna/associations/%s' % association_id, raw=True, **kwargs)
|
||||
res = {}
|
||||
res['association'] = raw_data['data']
|
||||
res['association']['id'] = res['association']['rna_id']
|
||||
return {'data': res}
|
||||
|
||||
@endpoint(
|
||||
perm='can_access',
|
||||
|
|
|
@ -160,8 +160,8 @@ EXTRAITS_RCS_RESPONSE = {
|
|||
}
|
||||
|
||||
ASSOCIATIONS_RESPONSE = {
|
||||
"association": {
|
||||
"id": "W751135389",
|
||||
"data": {
|
||||
"rna_id": "W751135389",
|
||||
"titre": "ALLIANCE DU COEUR: UNION NATIONALE DES FEDERATIONS ET ASSOCIATIONS DE MALADES CARDIOVASCULAIRES",
|
||||
"objet": "information, soutien, solidarité et accompagnement psycho médico social des personnes malades cardiovasculaires et de leurs proches...",
|
||||
"siret": "42135938100025",
|
||||
|
@ -423,7 +423,10 @@ def test_etablissements_endpoint(app, resource):
|
|||
|
||||
def test_associations_endpoint(app, resource):
|
||||
with responses.RequestsMock() as rsps:
|
||||
rsps.get('https://entreprise.api.gouv.fr/v2/associations/443170139/', json=ASSOCIATIONS_RESPONSE)
|
||||
rsps.get(
|
||||
'https://entreprise.api.gouv.fr/v3/ministere_interieur/rna/associations/443170139',
|
||||
json=ASSOCIATIONS_RESPONSE,
|
||||
)
|
||||
response = app.get('/api-entreprise/test/associations/443170139/', params=REQUEST_PARAMS)
|
||||
assert 'data' in response.json
|
||||
data = response.json['data']
|
||||
|
|
Loading…
Reference in New Issue