Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix configuration parameter. Improving tests #166

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading