Adyen / Adyen/adyen-python-api-library
[Test] Add baseUrl environment tests to all service test files
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 68
- Forks
- 49
- Avg merge
- 2h 3m
- Merged PRs (30d)
- 2
Description
Context
RecurringTest.py has three tests that validate the baseUrl resolves correctly for both environments:
def test_base_url_test_environment(self):
url = self.adyen.client._determine_api_url("test", self.baseUrl)
self.assertEqual(url, self.baseUrl)
self.assertTrue(url.startswith("https://pal-test.adyen.com/pal/servlet/Recurring/"))
def test_base_url_live_environment(self):
self.adyen.client.live_endpoint_prefix = "1797a841fbb37ca7-AdyenDemo"
recurring_version = self.baseUrl.split("/")[-1]
url = self.adyen.client._determine_api_url("live", self.baseUrl)
self.assertEqual(
url,
f"https://1797a841fbb37ca7-AdyenDemo-pal-live.adyenpayments.com"
f"/pal/servlet/Recurring/{recurring_version}",
)
self.adyen.client.live_endpoint_prefix = None
def test_base_url_live_environment_no_prefix_raises(self):
self.adyen.client.live_endpoint_prefix = None
self.assertRaises(
AdyenEndpointInvalidFormat,
self.adyen.client._determine_api_url,
"live",
self.baseUrl,
)
These tests are missing from all other service test files:
BalancePlatformTest.pyBinLookupTest.pyCapitalTest.pyCheckoutTest.pyDataProtectionTest.pyDisputesTest.pyLegalEntityManagementTest.pyManagementTest.pyModificationTest.py(payments)PaymentTest.pyPosMobileTest.pySessionAuthenticationTest.pyStoredValueTest.pyThirdPartyPayoutTest.pyTransfersTest.py
Proposed Change
Add the equivalent of test_base_url_test_environment, test_base_url_live_environment, and test_base_url_live_environment_no_prefix_raises to each service test file, adapting the expected URLs to match the service's URL pattern (PAL, checkout, balancePlatform, management, etc.).
Note: test_base_url_live_environment_no_prefix_raises only applies to services that require a live_endpoint_prefix (i.e. PAL and checkout-based services).
Benefit
Ensures that URL resolution for both test and live environments is explicitly verified for every service, catching regressions in _determine_api_url early.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with RecurringTest.py and compare its three baseUrl tests with the listed service test files. Add equivalent test-environment and live-environment coverage using each service's URL pattern, applying the no-prefix case only to PAL and checkout-based services. Run the affected service tests and confirm every listed file has the appropriate coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100