Repository navigation
test: delete e2e merchant accounts after each run - #348
Merged
Merged
Conversation
Calls core-api's DELETE /merchant-accounts/{id} (gr4vy/core-api#9999)
directly, since it is not in the public spec. Failures are logged and
never fail the run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A create whose response is lost still leaves the account on the server; deleting an id that was never created returns 404, which cleanup already treats as done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Approval should wait until the undocumented destructive DELETE endpoint is exercised in the live e2e environment to verify authorization, response behavior, and complete resource teardown.
No open issues 🎉
What changed in this PR
Updates the E2E test harness to clean up merchant accounts created during test runs, preventing sandbox data from accumulating.
Changes:
- Adds an authenticated merchant-account deletion helper that treats 204 and 404 responses as successful cleanup.
- Cleans up the module-scoped merchant fixture after each test module.
- Handles setup failures and registers cleanup for the additional account created by the merchant-account CRUD test.
| File | Description |
|---|---|
tests/utils/environment.py |
Adds merchant-account deletion and setup-failure cleanup. |
tests/conftest.py |
Converts the merchant fixture to generator-based teardown cleanup. |
tests/backoffice/test_merchant_accounts.py |
Registers cleanup for the extra merchant account created by the CRUD test. |
Review effort: Lite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every e2e run left its merchant accounts behind on api.sandbox.e2e.gr4vy.app now that it is no longer reset. This deletes them with core-api's new
DELETE /merchant-accounts/{id}(gr4vy/core-api#9999, TA-19741). It isn't in the public spec, so the call is a raw request signed with the existingPRIVATE_KEY. A failed delete is logged and never fails the run (204 and 404 both count as done).setup_merchantalso deletes the account if the mock-card service fails to create, andtest_merchant_accounts.pydeletes its extra account withrequest.addfinalizer.Cleanup is armed before the create call, so an account whose create response is lost still gets deleted (a never-created id just returns 404).
Verified:
pylint testsis 10/10. Not yet run live against e2e.🤖 Generated with Claude Code