Skip to content

Commit 3cf05d0

Browse files
committed
tests: fix failing auth react tests
1 parent e9292df commit 3cf05d0

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

supertokens_python/recipe/multitenancy/recipe_implementation.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from .utils import MultitenancyConfig
4646

4747
from supertokens_python.querier import NormalisedURLPath
48+
from .constants import DEFAULT_TENANT_ID
4849

4950

5051
def parse_tenant_config(tenant: Dict[str, Any]) -> TenantConfigResponse:
@@ -161,7 +162,7 @@ async def get_tenant(
161162
self, tenant_id: Optional[str], user_context: Dict[str, Any]
162163
) -> Optional[GetTenantOkResult]:
163164
res = await self.querier.send_get_request(
164-
NormalisedURLPath(f"{tenant_id}/recipe/multitenancy/tenant"),
165+
NormalisedURLPath(f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant"),
165166
)
166167

167168
if res["status"] == "TENANT_NOT_FOUND_ERROR":
@@ -209,7 +210,7 @@ async def create_or_update_third_party_config(
209210
user_context: Dict[str, Any],
210211
) -> CreateOrUpdateThirdPartyConfigOkResult:
211212
response = await self.querier.send_put_request(
212-
NormalisedURLPath(f"{tenant_id}/recipe/multitenancy/config/thirdparty"),
213+
NormalisedURLPath(f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/config/thirdparty"),
213214
{
214215
"config": config.to_json(),
215216
"skipValidation": skip_validation is True,
@@ -228,7 +229,7 @@ async def delete_third_party_config(
228229
) -> DeleteThirdPartyConfigOkResult:
229230
response = await self.querier.send_post_request(
230231
NormalisedURLPath(
231-
f"{tenant_id}/recipe/multitenancy/config/thirdparty/remove"
232+
f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/config/thirdparty/remove"
232233
),
233234
{
234235
"thirdPartyId": third_party_id,
@@ -240,7 +241,7 @@ async def delete_third_party_config(
240241
)
241242

242243
async def associate_user_to_tenant(
243-
self, tenant_id: str | None, user_id: str, user_context: Dict[str, Any]
244+
self, tenant_id: Optional[str], user_id: str, user_context: Dict[str, Any]
244245
) -> Union[
245246
AssociateUserToTenantOkResult,
246247
AssociateUserToTenantUnknownUserIdError,
@@ -249,7 +250,7 @@ async def associate_user_to_tenant(
249250
AssociateUserToTenantThirdPartyUserAlreadyExistsError,
250251
]:
251252
response: Dict[str, Any] = await self.querier.send_post_request(
252-
NormalisedURLPath(f"{tenant_id}/recipe/multitenancy/tenant/user"),
253+
NormalisedURLPath(f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant/user"),
253254
{
254255
"userId": user_id,
255256
},
@@ -277,10 +278,10 @@ async def associate_user_to_tenant(
277278
raise Exception("Should never come here")
278279

279280
async def dissociate_user_from_tenant(
280-
self, tenant_id: str | None, user_id: str, user_context: Dict[str, Any]
281+
self, tenant_id: Optional[str], user_id: str, user_context: Dict[str, Any]
281282
) -> DisassociateUserFromTenantOkResult:
282283
response = await self.querier.send_post_request(
283-
NormalisedURLPath(f"{tenant_id}/recipe/multitenancy/tenant/user/remove"),
284+
NormalisedURLPath(f"{tenant_id or DEFAULT_TENANT_ID}/recipe/multitenancy/tenant/user/remove"),
284285
{
285286
"userId": user_id,
286287
},

supertokens_python/recipe/passwordless/api/implementation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,17 +289,17 @@ async def consume_code_post(
289289
ev_instance = EmailVerificationRecipe.get_instance_optional()
290290
if ev_instance is not None:
291291
token_response = await ev_instance.recipe_implementation.create_email_verification_token(
292-
tenant_id, user.user_id, user.email, user_context
292+
user.user_id, user.email, tenant_id, user_context
293293
)
294294

295295
if isinstance(token_response, CreateEmailVerificationTokenOkResult):
296296
await ev_instance.recipe_implementation.verify_email_using_token(
297-
tenant_id, token_response.token, user_context
297+
token_response.token, tenant_id, user_context
298298
)
299299

300300
session = await create_new_session(
301-
tenant_id=tenant_id,
302301
request=api_options.request,
302+
tenant_id=tenant_id,
303303
user_id=user.user_id,
304304
access_token_payload={},
305305
session_data_in_database={},

supertokens_python/recipe/thirdparty/api/implementation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ async def sign_in_up_post(
123123

124124
if isinstance(token_response, CreateEmailVerificationTokenOkResult):
125125
await ev_instance.recipe_implementation.verify_email_using_token(
126-
tenant_id=tenant_id,
127126
token=token_response.token,
127+
tenant_id=tenant_id,
128128
user_context=user_context,
129129
)
130130

131131
user = signinup_response.user
132132
session = await create_new_session(
133-
tenant_id=tenant_id,
134133
request=api_options.request,
134+
tenant_id=tenant_id,
135135
user_id=user.user_id,
136136
user_context=user_context,
137137
)

0 commit comments

Comments
 (0)