22from typing import Any , Dict , List
33
44import pytest
5+
56from supertokens_python import InputAppInfo , SupertokensConfig , init
67from supertokens_python .recipe import (
78 emailpassword ,
@@ -31,22 +32,6 @@ async def test_init_validation_emailpassword():
3132 )
3233 assert "app_info must be an instance of InputAppInfo" == str (ex .value )
3334
34- with pytest .raises (ValueError ) as ex :
35- init (
36- supertokens_config = SupertokensConfig ("http://localhost:3567" ),
37- app_info = InputAppInfo (
38- app_name = "SuperTokens Demo" ,
39- api_domain = "http://api.supertokens.io" ,
40- website_domain = "http://supertokens.io" ,
41- api_base_path = "/auth" ,
42- ),
43- framework = "fastapi" ,
44- recipe_list = [
45- emailpassword .init (sign_up_feature = "sign up" ), # type: ignore
46- ],
47- )
48- assert "sign_up_feature must be of type InputSignUpFeature or None" == str (ex .value )
49-
5035 with pytest .raises (ValueError ) as ex :
5136 init (
5237 supertokens_config = SupertokensConfig ("http://localhost:3567" ),
@@ -67,22 +52,6 @@ async def test_init_validation_emailpassword():
6752 == str (ex .value )
6853 )
6954
70- with pytest .raises (ValueError ) as ex :
71- init (
72- supertokens_config = SupertokensConfig ("http://localhost:3567" ),
73- app_info = InputAppInfo (
74- app_name = "SuperTokens Demo" ,
75- api_domain = "http://api.supertokens.io" ,
76- website_domain = "http://supertokens.io" ,
77- api_base_path = "/auth" ,
78- ),
79- framework = "fastapi" ,
80- recipe_list = [
81- emailpassword .init (override = "override" ), # type: ignore
82- ],
83- )
84- assert "override must be of type InputOverrideConfig or None" == str (ex .value )
85-
8655
8756async def get_email_for_user_id (_ : str , __ : Dict [str , Any ]):
8857 return GetEmailForUserIdOkResult (
"[email protected] " )
@@ -307,7 +276,9 @@ async def send_email(
307276 clients = [
308277 thirdparty .ProviderClientConfig (
309278 client_id = os .environ .get ("GOOGLE_CLIENT_ID" ), # type: ignore
310- client_secret = os .environ .get ("GOOGLE_CLIENT_SECRET" ), # type: ignore
279+ client_secret = os .environ .get (
280+ "GOOGLE_CLIENT_SECRET"
281+ ), # type: ignore
311282 )
312283 ],
313284 )
@@ -318,7 +289,9 @@ async def send_email(
318289 clients = [
319290 thirdparty .ProviderClientConfig (
320291 client_id = os .environ .get ("FACEBOOK_CLIENT_ID" ), # type: ignore
321- client_secret = os .environ .get ("FACEBOOK_CLIENT_SECRET" ), # type: ignore
292+ client_secret = os .environ .get (
293+ "FACEBOOK_CLIENT_SECRET"
294+ ), # type: ignore
322295 )
323296 ],
324297 )
@@ -329,7 +302,9 @@ async def send_email(
329302 clients = [
330303 thirdparty .ProviderClientConfig (
331304 client_id = os .environ .get ("GITHUB_CLIENT_ID" ), # type: ignore
332- client_secret = os .environ .get ("GITHUB_CLIENT_SECRET" ), # type: ignore
305+ client_secret = os .environ .get (
306+ "GITHUB_CLIENT_SECRET"
307+ ), # type: ignore
333308 )
334309 ],
335310 )
@@ -365,6 +340,9 @@ async def test_init_validation_session():
365340 api_base_path = "/auth" ,
366341 ),
367342 framework = "fastapi" ,
343+ # NOTE: Type is ignored in the following line because that
344+ # is what is being tested for so that the SDK throws an error
345+ # on invalid type.
368346 recipe_list = [session .init (error_handlers = "error handlers" )], # type: ignore
369347 )
370348 assert "error_handlers must be an instance of ErrorHandlers or None" == str (
@@ -401,6 +379,9 @@ async def test_init_validation_thirdparty():
401379 ),
402380 framework = "fastapi" ,
403381 recipe_list = [
382+ # NOTE: Type is ignored in the following line because that
383+ # is what is being tested for so that the SDK throws an error
384+ # on invalid type.
404385 thirdparty .init (sign_in_and_up_feature = "sign in up" ) # type: ignore
405386 ],
406387 )
0 commit comments