Skip to content

Commit 4476d1e

Browse files
SNOW-2043523: Tests parametrized with host
1 parent 838d135 commit 4476d1e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/unit/test_auth_oauth_auth_code.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,13 @@ def fake_get_request_token_response(_, fields: dict[str, str]):
6969

7070

7171
@pytest.mark.parametrize(
72-
"name, client_id, client_secret, auth_url, token_url, expected_local",
72+
"name, client_id, client_secret, host, auth_url, token_url, expected_local",
7373
[
7474
(
7575
"Client credentials not supplied and Snowflake as IdP",
7676
"",
7777
"",
78+
"example.snowflakecomputing.com",
7879
"https://example.snowflakecomputing.com/oauth/authorize",
7980
"https://example.snowflakecomputing.com/oauth/token",
8081
True,
@@ -85,12 +86,14 @@ def fake_get_request_token_response(_, fields: dict[str, str]):
8586
"",
8687
"",
8788
"",
89+
"",
8890
True,
8991
),
9092
(
9193
"Client credentials supplied",
9294
"testClientID",
9395
"testClientSecret",
96+
"example.snowflakecomputing.com",
9497
"https://example.snowflakecomputing.com/oauth/authorize",
9598
"https://example.snowflakecomputing.com/oauth/token",
9699
False,
@@ -99,6 +102,7 @@ def fake_get_request_token_response(_, fields: dict[str, str]):
99102
"Only client ID supplied",
100103
"testClientID",
101104
"",
105+
"example.snowflakecomputing.com",
102106
"https://example.snowflakecomputing.com/oauth/authorize",
103107
"https://example.snowflakecomputing.com/oauth/token",
104108
False,
@@ -107,6 +111,7 @@ def fake_get_request_token_response(_, fields: dict[str, str]):
107111
"Non-Snowflake IdP",
108112
"",
109113
"",
114+
"example.snowflakecomputing.com",
110115
"https://example.com/oauth/authorize",
111116
"https://example.com/oauth/token",
112117
False,
@@ -115,6 +120,7 @@ def fake_get_request_token_response(_, fields: dict[str, str]):
115120
"[China] Client credentials not supplied and Snowflake as IdP",
116121
"",
117122
"",
123+
"example.snowflakecomputing.cn",
118124
"https://example.snowflakecomputing.cn/oauth/authorize",
119125
"https://example.snowflakecomputing.cn/oauth/token",
120126
True,
@@ -123,6 +129,7 @@ def fake_get_request_token_response(_, fields: dict[str, str]):
123129
"[China] Client credentials supplied",
124130
"testClientID",
125131
"testClientSecret",
132+
"example.snowflakecomputing.cn",
126133
"https://example.snowflakecomputing.cn/oauth/authorize",
127134
"https://example.snowflakecomputing.cn/oauth/token",
128135
False,
@@ -131,14 +138,15 @@ def fake_get_request_token_response(_, fields: dict[str, str]):
131138
"[China] Only client ID supplied",
132139
"testClientID",
133140
"",
141+
"example.snowflakecomputing.cn",
134142
"https://example.snowflakecomputing.cn/oauth/authorize",
135143
"https://example.snowflakecomputing.cn/oauth/token",
136144
False,
137145
),
138146
],
139147
)
140148
def test_eligible_for_default_client_credentials_via_constructor(
141-
name, client_id, client_secret, auth_url, token_url, expected_local
149+
name, client_id, client_secret, host, auth_url, token_url, expected_local
142150
):
143151
auth = AuthByOauthCode(
144152
application="app",
@@ -148,6 +156,7 @@ def test_eligible_for_default_client_credentials_via_constructor(
148156
token_request_url=token_url,
149157
redirect_uri="redirectUri:{port}",
150158
scope="scope",
159+
host=host,
151160
)
152161
if expected_local:
153162
assert (

0 commit comments

Comments
 (0)