PTHMINT-112: Improve E2E test environment isolation#53
Open
PTHMINT-112: Improve E2E test environment isolation#53
Conversation
Use a dedicated E2E_API_KEY, centralize E2E SDK bootstrap in shared fixtures, and keep end-to-end tests isolated from the general SDK environment configuration. Update the E2E documentation and environment example accordingly.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #53 +/- ##
=======================================
Coverage 90.81% 90.81%
=======================================
Files 147 147
Lines 2579 2579
=======================================
Hits 2342 2342
Misses 237 237 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves end-to-end (E2E) test isolation by introducing a dedicated E2E_API_KEY and centralizing E2E SDK creation in shared pytest fixtures, keeping E2E configuration separate from the general SDK environment setup.
Changes:
- Added
E2E_API_KEYhandling and sharede2e_sdk/e2e_sdk_factoryfixtures intests/multisafepay/e2e/conftest.py. - Updated E2E example tests to consume the shared fixtures instead of reading
API_KEY+.envper module. - Documented the dedicated E2E environment variable in
README.mdand.env.example.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/multisafepay/e2e/conftest.py | Adds session-scoped E2E API key + SDK factory fixtures and skips E2E suite cleanly when missing. |
| tests/multisafepay/e2e/examples/transport/test_custom_urllib3_transport.py | Switches to e2e_sdk_factory and updates docs to E2E_API_KEY. |
| tests/multisafepay/e2e/examples/transport/test_custom_requests_session_transport.py | Switches to e2e_sdk_factory for custom requests.Session transport. |
| tests/multisafepay/e2e/examples/transport/test_custom_httpx_transport.py | Switches to e2e_sdk_factory and updates docs to E2E_API_KEY. |
| tests/multisafepay/e2e/examples/transaction_manager/test_get_transactions.py | Uses shared e2e_sdk fixture instead of loading env vars locally. |
| tests/multisafepay/e2e/examples/recurring_manager/test_recurring.py | Uses shared e2e_sdk fixture for SDK setup. |
| tests/multisafepay/e2e/examples/payment_method_manager/test_get_payment_methods.py | Uses shared e2e_sdk fixture for manager creation. |
| tests/multisafepay/e2e/examples/payment_method_manager/test_get_by_gateway_code.py | Uses shared e2e_sdk fixture for manager creation. |
| tests/multisafepay/e2e/examples/order_manager/test_update.py | Uses shared e2e_sdk fixture for manager creation. |
| tests/multisafepay/e2e/examples/order_manager/test_refund.py | Uses shared e2e_sdk fixture for manager creation. |
| tests/multisafepay/e2e/examples/order_manager/test_refund_by_shopping_cart.py | Uses shared e2e_sdk fixture for manager creation. |
| tests/multisafepay/e2e/examples/order_manager/test_refund_by_item.py | Uses shared e2e_sdk fixture for manager creation. |
| tests/multisafepay/e2e/examples/order_manager/test_get_order.py | Uses shared e2e_sdk fixture for manager creation. |
| tests/multisafepay/e2e/examples/order_manager/test_create.py | Uses shared e2e_sdk fixture for manager creation. |
| tests/multisafepay/e2e/examples/order_manager/test_capture.py | Uses shared e2e_sdk fixture for manager creation. |
| tests/multisafepay/e2e/examples/me_manager/test_get_me.py | Uses shared e2e_sdk fixture for manager creation. |
| tests/multisafepay/e2e/examples/issuer_manager/test_get_issuers_by_gateway_code.py | Uses shared e2e_sdk fixture for manager creation. |
| tests/multisafepay/e2e/examples/gateway_manager/test_get_gateways.py | Uses shared e2e_sdk fixture for manager creation. |
| tests/multisafepay/e2e/examples/gateway_manager/test_get_by_code.py | Uses shared e2e_sdk fixture for manager creation. |
| tests/multisafepay/e2e/examples/category_manager/test_get_categories.py | Uses shared e2e_sdk fixture for manager creation. |
| tests/multisafepay/e2e/examples/capture_manager/test_capture_reservation_cancel.py | Uses shared e2e_sdk fixture for SDK setup. |
| tests/multisafepay/e2e/examples/auth_manager/test_get_api_token.py | Uses shared e2e_sdk fixture for manager creation. |
| README.md | Documents E2E test environment targeting and E2E_API_KEY usage. |
| .env.example | Adds E2E_API_KEY alongside API_KEY. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Ensure E2E fixtures remain isolated from local custom-base-url overrides. The E2E SDK factory now temporarily clears MSP_SDK_BUILD_PROFILE, MSP_SDK_ALLOW_CUSTOM_BASE_URL and MSP_SDK_CUSTOM_BASE_URL while instantiating the SDK, then restores previous values. Added a guard to assert the resulting client URL is Client.TEST_URL, so E2E always targets the test environment when using E2E_API_KEY.
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.
Use a dedicated E2E_API_KEY, centralize E2E SDK bootstrap in shared fixtures, and keep end-to-end tests isolated from the general SDK environment configuration. Update the E2E documentation and environment example accordingly.