Adyen / Adyen/adyen-python-api-library

[Test] Add baseUrl environment tests to all service test files

Open
#475 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

do not stale Test
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.py
  • BinLookupTest.py
  • CapitalTest.py
  • CheckoutTest.py
  • DataProtectionTest.py
  • DisputesTest.py
  • LegalEntityManagementTest.py
  • ManagementTest.py
  • ModificationTest.py (payments)
  • PaymentTest.py
  • PosMobileTest.py
  • SessionAuthenticationTest.py
  • StoredValueTest.py
  • ThirdPartyPayoutTest.py
  • TransfersTest.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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.