2
2
from typing import Any , Dict , List
3
3
4
4
import pytest
5
+
5
6
from supertokens_python import InputAppInfo , SupertokensConfig , init
6
7
from supertokens_python .recipe import (
7
8
emailpassword ,
@@ -31,22 +32,6 @@ async def test_init_validation_emailpassword():
31
32
)
32
33
assert "app_info must be an instance of InputAppInfo" == str (ex .value )
33
34
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
-
50
35
with pytest .raises (ValueError ) as ex :
51
36
init (
52
37
supertokens_config = SupertokensConfig ("http://localhost:3567" ),
@@ -67,22 +52,6 @@ async def test_init_validation_emailpassword():
67
52
== str (ex .value )
68
53
)
69
54
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
-
86
55
87
56
async def get_email_for_user_id (_ : str , __ : Dict [str , Any ]):
88
57
return GetEmailForUserIdOkResult (
"[email protected] " )
@@ -307,7 +276,9 @@ async def send_email(
307
276
clients = [
308
277
thirdparty .ProviderClientConfig (
309
278
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
311
282
)
312
283
],
313
284
)
@@ -318,7 +289,9 @@ async def send_email(
318
289
clients = [
319
290
thirdparty .ProviderClientConfig (
320
291
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
322
295
)
323
296
],
324
297
)
@@ -329,7 +302,9 @@ async def send_email(
329
302
clients = [
330
303
thirdparty .ProviderClientConfig (
331
304
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
333
308
)
334
309
],
335
310
)
@@ -365,6 +340,9 @@ async def test_init_validation_session():
365
340
api_base_path = "/auth" ,
366
341
),
367
342
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.
368
346
recipe_list = [session .init (error_handlers = "error handlers" )], # type: ignore
369
347
)
370
348
assert "error_handlers must be an instance of ErrorHandlers or None" == str (
@@ -401,6 +379,9 @@ async def test_init_validation_thirdparty():
401
379
),
402
380
framework = "fastapi" ,
403
381
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.
404
385
thirdparty .init (sign_in_and_up_feature = "sign in up" ) # type: ignore
405
386
],
406
387
)
0 commit comments