Skip to content

api_particulier: Passage à la V3 - #6932

Merged
francoisfreitag merged 5 commits into
masterfrom
ff/api-part-v3-2
Oct 9, 2025
Merged

francoisfreitag merged 5 commits into
masterfrom
ff/api-part-v3-2

Conversation

@francoisfreitag

@francoisfreitag francoisfreitag commented Sep 30, 2025 •

Copy link
Copy Markdown
Member

Comment thread itou/utils/apis/api_particulier.py Resolved
Comment thread itou/eligibility/tasks.py Resolved
Comment thread itou/eligibility/tasks.py Resolved
Comment thread itou/eligibility/tasks.py Resolved
@xavfernandez

Copy link
Copy Markdown
Contributor

A priori on aura toujours

logger.error(
"Error certifying criterion %r: code=%d json=%s",
criterion,
exc.response.status_code,
criterion.data_returned_by_api,
)
et l'erreur Sentry la plus fréquente ? 🕵️

@francoisfreitag
francoisfreitag force-pushed the ff/api-part-v3 branch 2 times, most recently from 89ffba4 to fc67f95 Compare October 6, 2025 07:10
Base automatically changed from ff/api-part-v3 to master October 6, 2025 08:22
@francoisfreitag

Copy link
Copy Markdown
Member Author

A priori on aura toujours

logger.error(
"Error certifying criterion %r: code=%d json=%s",
criterion,
exc.response.status_code,
criterion.data_returned_by_api,
)

et l'erreur Sentry la plus fréquente ? 🕵️

En effet. On sera dans une bien meilleure position pour mieux logger les erreurs avec le nouveau code, car la gestion des erreurs sur la V3 de l’API particulier est plus simple.
On saura mieux quoi logguer.

Comment thread itou/utils/apis/api_particulier.py Resolved
Comment thread itou/utils/apis/api_particulier.py Resolved
response = RESPONSES[criteria_kind][ResponseKind.CERTIFIED]
respx_mock.get(settings.API_PARTICULIER_BASE_URL + api_particulier.ENDPOINTS[criteria_kind]).respond(
json=RESPONSES[criteria_kind][ResponseKind.CERTIFIED]
status_code=response["status_code"], json=response["json"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je sais pas si c'est une "bonne" idée mais pour ce genre de cas on pourrais faire :

Suggested change
status_code=response["status_code"], json=response["json"]
**response

Même si je ne vois pas le moment où on aurais besoin de rajouter un argument, mais on aurais dit la même chose pour status_code il y a quelque mois 😁.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je ne parierais pas sur le fait que le prochain ajout soit immédiatement compatible avec les arguments de respx_mock. Je vais laisser ça pour la prochaine fois.

Comment thread tests/eligibility/test_tasks.py Resolved
Comment thread tests/eligibility/test_tasks.py Resolved
Comment thread itou/utils/apis/api_particulier.py Resolved
Comment thread tests/eligibility/test_tasks.py Resolved
Comment thread tests/eligibility/test_tasks.py Resolved
Comment thread itou/utils/apis/api_particulier.py Resolved
Comment thread itou/eligibility/tasks.py Resolved
Allow reviewing the complete URL in tests, rather than basing it on
dynamic values. During the port to V3, multiple copy-pasta could have
caused mayhem when the endpoint did not correspond to the certified
criteria (e.g. RSA would go to /v3/allocation_adulte_handicape/…), with
the tests happily passing.
…tified

Instead of always using RSA, allows for more API particulier URLs
coverage in tests.
@francoisfreitag
francoisfreitag added this pull request to the merge queue Oct 9, 2025
Merged via the queue into master with commit a8a30d6 Oct 9, 2025
@francoisfreitag
francoisfreitag deleted the ff/api-part-v3-2 branch October 9, 2025 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants