Skip to content

Commit 96e7b8c

Browse files
committed
Use new commercetools api endpoint names in testing code
Just to match the readme
1 parent f4ec73c commit 96e7b8c

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

src/commercetools/contrib/pytest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def ct_platform_client(commercetools_api) -> typing.Generator[Client, None, None
3030
client_id="client-id",
3131
client_secret="client-secret",
3232
scope=[],
33-
url="https://api.sphere.io",
34-
token_url="https://auth.sphere.io/oauth/token",
33+
url="https://api.europe-west1.gcp.commercetools.com",
34+
token_url="https://auth.europe-west1.gcp.commercetools.com/oauth/token",
3535
)
3636

3737

@@ -42,8 +42,8 @@ def commercetools_client(commercetools_api) -> typing.Generator[Client, None, No
4242
client_id="client-id",
4343
client_secret="client-secret",
4444
scope=[],
45-
url="https://api.sphere.io",
46-
token_url="https://auth.sphere.io/oauth/token",
45+
url="https://api.europe-west1.gcp.commercetools.com",
46+
token_url="https://auth.europe-west1.gcp.commercetools.com/oauth/token",
4747
)
4848

4949

src/commercetools/testing/internal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class InternalBackend(BaseBackend):
66
path_prefix = r"/-/(?P<path>.*)"
7-
hostnames = ["auth.sphere.io", "localhost"]
7+
hostnames = ["auth.europe-west1.gcp.commercetools.com", "auth.sphere.io", "localhost"]
88

99
def urls(self):
1010
return [("^health$", "GET", self.health)]

tests/platform/test_client.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ def client_environment_settings(monkeypatch):
1515
monkeypatch.setenv("CTP_CLIENT_ID", "client_id")
1616
monkeypatch.setenv("CTP_CLIENT_SECRET", "client_secret")
1717
monkeypatch.setenv("CTP_CLIENT_SCOPES", "some_scope")
18-
monkeypatch.setenv("CTP_API_URL", "https://api.shere.io")
19-
monkeypatch.setenv("CTP_AUTH_URL", "https://auth.sphere.io")
18+
monkeypatch.setenv("CTP_API_URL", "https://api.europe-west1.gcp.commercetools.com")
19+
monkeypatch.setenv("CTP_AUTH_URL", "https://auth.europe-west1.gcp.commercetools.com")
2020

2121

2222
def test_client_with_environment_settings_is_setup(
@@ -33,8 +33,8 @@ def test_auto_refresh(commercetools_api):
3333
client_id="unittest",
3434
client_secret="mysecret",
3535
project_key="test",
36-
url="https://api.sphere.io",
37-
token_url="https://auth.sphere.io/oauth/token",
36+
url="https://api.europe-west1.gcp.commercetools.com",
37+
token_url="https://auth.europe-west1.gcp.commercetools.com/oauth/token",
3838
)
3939
client.products.query()
4040
time.sleep(1)
@@ -43,7 +43,7 @@ def test_auto_refresh(commercetools_api):
4343

4444
auth_headers = set()
4545
for request in commercetools_api.requests_mock.request_history:
46-
if request.url.startswith("https://api.sphere.io/"):
46+
if request.url.startswith("https://api.europe-west1.gcp.commercetools.com/"):
4747
auth_headers.add(request.headers["Authorization"])
4848

4949
assert len(auth_headers) == 2
@@ -55,17 +55,17 @@ def test_cache_token(commercetools_api):
5555
client_id="unittest",
5656
client_secret="none",
5757
project_key="test",
58-
url="https://api.sphere.io",
59-
token_url="https://auth.sphere.io/oauth/token",
58+
url="https://api.europe-west1.gcp.commercetools.com",
59+
token_url="https://auth.europe-west1.gcp.commercetools.com/oauth/token",
6060
)
6161
assert len(commercetools_api.requests_mock.request_history) == 1
6262

6363
Client(
6464
client_id="unittest",
6565
client_secret="none",
6666
project_key="test",
67-
url="https://api.sphere.io",
68-
token_url="https://auth.sphere.io/oauth/token",
67+
url="https://api.europe-west1.gcp.commercetools.com",
68+
token_url="https://auth.europe-west1.gcp.commercetools.com/oauth/token",
6969
)
7070
assert len(commercetools_api.requests_mock.request_history) == 1
7171

@@ -74,15 +74,15 @@ def test_allows_passing_custom_http_adapter():
7474
my_adapter = Adapter()
7575
my_adapter.register_uri(
7676
"POST",
77-
"https://auth.sphere.io/oauth/token",
77+
"https://auth.europe-west1.gcp.commercetools.com/oauth/token",
7878
json=dict(access_token="my_mock_access_token"),
7979
)
8080
Client(
8181
client_id="unittest",
8282
client_secret="none",
8383
project_key="test",
84-
url="https://api.sphere.io",
85-
token_url="https://auth.sphere.io/oauth/token",
84+
url="https://api.europe-west1.gcp.commercetools.com",
85+
token_url="https://auth.europe-west1.gcp.commercetools.com/oauth/token",
8686
http_adapter=my_adapter,
8787
)
8888
assert len(my_adapter.request_history) == 1

tests/platform/test_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
@pytest.mark.parametrize(
77
"token_url,expected_url",
88
[
9-
("https://auth.sphere.io", "https://auth.sphere.io/oauth/token"),
10-
("https://auth.sphere.io/oauth/token", "https://auth.sphere.io/oauth/token"),
9+
("https://auth.europe-west1.gcp.commercetools.com", "https://auth.europe-west1.gcp.commercetools.com/oauth/token"),
10+
("https://auth.europe-west1.gcp.commercetools.com/oauth/token", "https://auth.europe-west1.gcp.commercetools.com/oauth/token"),
1111
("https://auth.commercetools.co", "https://auth.commercetools.co/oauth/token"),
1212
(
13-
"https://auth.sphere.io?test=123",
14-
"https://auth.sphere.io/oauth/token?test=123",
13+
"https://auth.europe-west1.gcp.commercetools.com?test=123",
14+
"https://auth.europe-west1.gcp.commercetools.com/oauth/token?test=123",
1515
),
1616
],
1717
)

0 commit comments

Comments
 (0)