|
20 | 20 | from fastapi import FastAPI |
21 | 21 | from fastapi.requests import Request |
22 | 22 | from fastapi.testclient import TestClient |
23 | | -from pytest import fixture, mark |
| 23 | +from pytest import fixture, mark, raises |
24 | 24 | from urllib.parse import urlparse |
25 | 25 |
|
26 | 26 | from supertokens_python import InputAppInfo, SupertokensConfig, init |
| 27 | +from supertokens_python.exceptions import GeneralError |
27 | 28 | from supertokens_python.framework.fastapi import get_middleware |
28 | 29 | from supertokens_python.ingredients.emaildelivery import EmailDeliveryInterface |
29 | 30 | from supertokens_python.ingredients.emaildelivery.types import ( |
|
41 | 42 | from supertokens_python.recipe.thirdpartyemailpassword.asyncio import ( |
42 | 43 | create_reset_password_link, |
43 | 44 | ) |
| 45 | +from supertokens_python.recipe.thirdpartyemailpassword.interfaces import ( |
| 46 | + CreateResetPasswordLinkUnknownUserIdError, |
| 47 | +) |
44 | 48 | from supertokens_python.recipe.emailverification.emaildelivery.services import ( |
45 | 49 | SMTPService as EVSMTPService, |
46 | 50 | ) |
@@ -1075,3 +1079,10 @@ async def test_create_reset_password_link( |
1075 | 1079 | assert url.path == "/auth/reset-password" |
1076 | 1080 | assert "tenantId=public" in queries |
1077 | 1081 | assert "rid=thirdpartyemailpassword" in queries |
| 1082 | + |
| 1083 | + link = await create_reset_password_link("public", "invalidUserId") |
| 1084 | + assert isinstance(link, CreateResetPasswordLinkUnknownUserIdError) |
| 1085 | + |
| 1086 | + with raises(GeneralError) as err: |
| 1087 | + await create_reset_password_link("invalidTenantId", user_info["id"]) |
| 1088 | + assert "status code: 400" in str(err.value) |
0 commit comments