-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Failing tests regarding any type support in formFields
This commit fixes issues with some tests that were failing after adding support for any type of field values in formFields
- Loading branch information
1 parent
89b7be2
commit 674cc6e
Showing
2 changed files
with
23 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
from typing import Any, Dict, List | ||
|
||
import pytest | ||
|
||
from supertokens_python import InputAppInfo, SupertokensConfig, init | ||
from supertokens_python.recipe import ( | ||
emailpassword, | ||
|
@@ -31,22 +32,6 @@ async def test_init_validation_emailpassword(): | |
) | ||
assert "app_info must be an instance of InputAppInfo" == str(ex.value) | ||
|
||
with pytest.raises(ValueError) as ex: | ||
init( | ||
supertokens_config=SupertokensConfig("http://localhost:3567"), | ||
app_info=InputAppInfo( | ||
app_name="SuperTokens Demo", | ||
api_domain="http://api.supertokens.io", | ||
website_domain="http://supertokens.io", | ||
api_base_path="/auth", | ||
), | ||
framework="fastapi", | ||
recipe_list=[ | ||
emailpassword.init(sign_up_feature="sign up"), # type: ignore | ||
], | ||
) | ||
assert "sign_up_feature must be of type InputSignUpFeature or None" == str(ex.value) | ||
|
||
with pytest.raises(ValueError) as ex: | ||
init( | ||
supertokens_config=SupertokensConfig("http://localhost:3567"), | ||
|
@@ -67,22 +52,6 @@ async def test_init_validation_emailpassword(): | |
== str(ex.value) | ||
) | ||
|
||
with pytest.raises(ValueError) as ex: | ||
init( | ||
supertokens_config=SupertokensConfig("http://localhost:3567"), | ||
app_info=InputAppInfo( | ||
app_name="SuperTokens Demo", | ||
api_domain="http://api.supertokens.io", | ||
website_domain="http://supertokens.io", | ||
api_base_path="/auth", | ||
), | ||
framework="fastapi", | ||
recipe_list=[ | ||
emailpassword.init(override="override"), # type: ignore | ||
], | ||
) | ||
assert "override must be of type InputOverrideConfig or None" == str(ex.value) | ||
|
||
|
||
async def get_email_for_user_id(_: str, __: Dict[str, Any]): | ||
return GetEmailForUserIdOkResult("[email protected]") | ||
|
@@ -307,7 +276,9 @@ async def send_email( | |
clients=[ | ||
thirdparty.ProviderClientConfig( | ||
client_id=os.environ.get("GOOGLE_CLIENT_ID"), # type: ignore | ||
client_secret=os.environ.get("GOOGLE_CLIENT_SECRET"), # type: ignore | ||
client_secret=os.environ.get( | ||
"GOOGLE_CLIENT_SECRET" | ||
), # type: ignore | ||
) | ||
], | ||
) | ||
|
@@ -318,7 +289,9 @@ async def send_email( | |
clients=[ | ||
thirdparty.ProviderClientConfig( | ||
client_id=os.environ.get("FACEBOOK_CLIENT_ID"), # type: ignore | ||
client_secret=os.environ.get("FACEBOOK_CLIENT_SECRET"), # type: ignore | ||
client_secret=os.environ.get( | ||
"FACEBOOK_CLIENT_SECRET" | ||
), # type: ignore | ||
) | ||
], | ||
) | ||
|
@@ -329,7 +302,9 @@ async def send_email( | |
clients=[ | ||
thirdparty.ProviderClientConfig( | ||
client_id=os.environ.get("GITHUB_CLIENT_ID"), # type: ignore | ||
client_secret=os.environ.get("GITHUB_CLIENT_SECRET"), # type: ignore | ||
client_secret=os.environ.get( | ||
"GITHUB_CLIENT_SECRET" | ||
), # type: ignore | ||
) | ||
], | ||
) | ||
|
@@ -365,6 +340,9 @@ async def test_init_validation_session(): | |
api_base_path="/auth", | ||
), | ||
framework="fastapi", | ||
# NOTE: Type is ignored in the following line because that | ||
# is what is being tested for so that the SDK throws an error | ||
# on invalid type. | ||
recipe_list=[session.init(error_handlers="error handlers")], # type: ignore | ||
) | ||
assert "error_handlers must be an instance of ErrorHandlers or None" == str( | ||
|
@@ -401,6 +379,9 @@ async def test_init_validation_thirdparty(): | |
), | ||
framework="fastapi", | ||
recipe_list=[ | ||
# NOTE: Type is ignored in the following line because that | ||
# is what is being tested for so that the SDK throws an error | ||
# on invalid type. | ||
thirdparty.init(sign_in_and_up_feature="sign in up") # type: ignore | ||
], | ||
) | ||
|