Skip to content

Commit

Permalink
Fix configuration parameter. Improve test (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
armando-rodriguez-cko authored Jun 13, 2024
1 parent e93ba76 commit 1bfb49e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions checkout_sdk/oauth_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def build(self):
scopes=self._scopes,
authorization_uri=self._authorization_uri),
environment=self._environment,
environment_subdomain=self._environment_subdomain,
http_client=self._http_client)
http_client=self._http_client,
environment_subdomain=self._environment_subdomain)
else:
configuration = CheckoutConfiguration(
credentials=OAuthSdkCredentials.init(http_client=self._http_client,
Expand Down
4 changes: 2 additions & 2 deletions checkout_sdk/previous/previous_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def build(self):
configuration = CheckoutConfiguration(
credentials=PreviousKeysSdkCredentials(secret_key=self._secret_key, public_key=self._public_key),
environment=self._environment,
environment_subdomain=self._environment_subdomain,
http_client=self._http_client)
http_client=self._http_client,
environment_subdomain=self._environment_subdomain)
else:
configuration = CheckoutConfiguration(
credentials=PreviousKeysSdkCredentials(secret_key=self._secret_key, public_key=self._public_key),
Expand Down
17 changes: 13 additions & 4 deletions tests/checkout_configuration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ def test_should_create_configuration():
http_client=http_client
)

assert Environment.sandbox().base_uri == configuration.environment.base_uri
assert "https://api.sandbox.checkout.com/" == configuration.environment.base_uri
assert configuration.credentials == credentials
assert configuration.environment.base_uri == Environment.sandbox().base_uri
assert configuration.environment.base_uri == "https://api.sandbox.checkout.com/"
assert configuration.http_client == http_client
assert configuration.environment_subdomain is None


@pytest.mark.parametrize(
Expand Down Expand Up @@ -53,7 +56,10 @@ def test_should_create_configuration_with_subdomain(subdomain, expected_url):
environment_subdomain=environment_subdomain
)

assert expected_url == configuration.environment_subdomain.base_uri
assert configuration.credentials == credentials
assert configuration.environment.base_uri == Environment.sandbox().base_uri
assert configuration.http_client == http_client
assert configuration.environment_subdomain.base_uri == expected_url


@pytest.mark.parametrize(
Expand Down Expand Up @@ -81,4 +87,7 @@ def test_should_create_configuration_with_bad_subdomain(subdomain, expected_url)
environment_subdomain=environment_subdomain
)

assert expected_url == configuration.environment_subdomain.base_uri
assert configuration.credentials == credentials
assert configuration.environment.base_uri == Environment.sandbox().base_uri
assert configuration.http_client == http_client
assert configuration.environment_subdomain.base_uri == expected_url

0 comments on commit 1bfb49e

Please sign in to comment.