48
48
get_session ,
49
49
refresh_session ,
50
50
)
51
+ from supertokens_python .recipe .session .constants import ANTI_CSRF_HEADER_KEY
51
52
from supertokens_python .utils import is_version_gte
52
53
from tests .utils import (
53
54
TEST_ACCESS_TOKEN_MAX_AGE_CONFIG_KEY ,
@@ -133,7 +134,11 @@ async def test_the_generate_token_api_with_valid_input_email_not_verified(
133
134
api_base_path = "/auth" ,
134
135
),
135
136
framework = "fastapi" ,
136
- recipe_list = [session .init (anti_csrf = "VIA_TOKEN" ), emailpassword .init ()],
137
+ recipe_list = [
138
+ session .init (anti_csrf = "VIA_TOKEN" ),
139
+ emailverification .init ("OPTIONAL" ),
140
+ emailpassword .init (),
141
+ ],
137
142
)
138
143
start_st ()
139
144
@@ -170,7 +175,11 @@ async def test_the_generate_token_api_with_valid_input_email_verified_and_test_e
170
175
api_base_path = "/auth" ,
171
176
),
172
177
framework = "fastapi" ,
173
- recipe_list = [session .init (anti_csrf = "VIA_TOKEN" ), emailpassword .init ()],
178
+ recipe_list = [
179
+ session .init (anti_csrf = "VIA_TOKEN" ),
180
+ emailverification .init ("OPTIONAL" ),
181
+ emailpassword .init (),
182
+ ],
174
183
)
175
184
start_st ()
176
185
@@ -213,7 +222,11 @@ async def test_the_generate_token_api_with_valid_input_no_session_and_check_outp
213
222
api_base_path = "/auth" ,
214
223
),
215
224
framework = "fastapi" ,
216
- recipe_list = [session .init (anti_csrf = "VIA_TOKEN" ), emailpassword .init ()],
225
+ recipe_list = [
226
+ session .init (anti_csrf = "VIA_TOKEN" ),
227
+ emailverification .init ("OPTIONAL" ),
228
+ emailpassword .init (),
229
+ ],
217
230
)
218
231
start_st ()
219
232
@@ -238,7 +251,11 @@ async def test_the_generate_token_api_with_an_expired_access_token_and_see_that_
238
251
api_base_path = "/auth" ,
239
252
),
240
253
framework = "fastapi" ,
241
- recipe_list = [session .init (anti_csrf = "VIA_TOKEN" ), emailpassword .init ()],
254
+ recipe_list = [
255
+ session .init (anti_csrf = "VIA_TOKEN" ),
256
+ emailverification .init ("OPTIONAL" ),
257
+ emailpassword .init (),
258
+ ],
242
259
)
243
260
start_st ()
244
261
@@ -723,7 +740,9 @@ async def custom_f(
723
740
assert token is not None
724
741
725
742
response_3 = driver_config_client .post (
726
- url = "/auth/user/email/verify" , json = {"method" : "token" , "token" : token }
743
+ url = "/auth/user/email/verify" ,
744
+ json = {"method" : "token" , "token" : token },
745
+ headers = {ANTI_CSRF_HEADER_KEY : response_1 .headers .get ("anti-csrf" )},
727
746
)
728
747
729
748
dict_response = json .loads (response_3 .text )
@@ -760,7 +779,11 @@ async def test_the_email_verify_with_no_session_using_the_get_method(
760
779
api_base_path = "/auth" ,
761
780
),
762
781
framework = "fastapi" ,
763
- recipe_list = [session .init (anti_csrf = "VIA_TOKEN" ), emailpassword .init ()],
782
+ recipe_list = [
783
+ session .init (anti_csrf = "VIA_TOKEN" ),
784
+ emailverification .init ("OPTIONAL" ),
785
+ emailpassword .init (),
786
+ ],
764
787
)
765
788
start_st ()
766
789
@@ -850,7 +873,9 @@ async def email_verify_post(
850
873
assert token is not None
851
874
852
875
response_3 = driver_config_client .post (
853
- url = "/auth/user/email/verify" , json = {"method" : "token" , "token" : token }
876
+ url = "/auth/user/email/verify" ,
877
+ json = {"method" : "token" , "token" : token },
878
+ headers = {ANTI_CSRF_HEADER_KEY : response_1 .headers .get ("anti-csrf" )},
854
879
)
855
880
856
881
dict_response = json .loads (response_3 .text )
@@ -946,7 +971,9 @@ async def email_verify_post(
946
971
assert token is not None
947
972
948
973
response_3 = driver_config_client .post (
949
- url = "/auth/user/email/verify" , json = {"method" : "token" , "token" : token }
974
+ url = "/auth/user/email/verify" ,
975
+ json = {"method" : "token" , "token" : token },
976
+ headers = {ANTI_CSRF_HEADER_KEY : response_1 .headers .get ("anti-csrf" )},
950
977
)
951
978
952
979
dict_response = json .loads (response_3 .text )
@@ -974,7 +1001,11 @@ async def test_the_generate_token_api_with_valid_input_and_then_remove_token(
974
1001
api_base_path = "/auth" ,
975
1002
),
976
1003
framework = "fastapi" ,
977
- recipe_list = [session .init (anti_csrf = "VIA_TOKEN" ), emailpassword .init ()],
1004
+ recipe_list = [
1005
+ session .init (anti_csrf = "VIA_TOKEN" ),
1006
+ emailverification .init ("OPTIONAL" ),
1007
+ emailpassword .init (),
1008
+ ],
978
1009
)
979
1010
start_st ()
980
1011
0 commit comments