@@ -767,4 +767,41 @@ async def test_too_many_fields(driver_config_client: TestClient):
767
767
assert dict_response ["message" ] == "Are you sending too many formFields?"
768
768
769
769
770
+ @mark .asyncio
771
+ async def test_non_optional_custom_field_without_input (
772
+ driver_config_client : TestClient ,
773
+ ):
774
+ init (
775
+ supertokens_config = SupertokensConfig ("http://localhost:3567" ),
776
+ app_info = InputAppInfo (
777
+ app_name = "SuperTokens Demo" ,
778
+ api_domain = "http://api.supertokens.io" ,
779
+ website_domain = "http://supertokens.io" ,
780
+ api_base_path = "/auth" ,
781
+ ),
782
+ framework = "fastapi" ,
783
+ recipe_list = [
784
+ emailpassword .init (
785
+ sign_up_feature = emailpassword .InputSignUpFeature (
786
+ form_fields = [
787
+ emailpassword .InputFormField ("test_field" , optional = False )
788
+ ]
789
+ )
790
+ ),
791
+ session .init (get_token_transfer_method = lambda _ , __ , ___ : "cookie" ),
792
+ ],
793
+ )
794
+ start_st ()
795
+
796
+ response_1 = sign_up_request (
797
+ driver_config_client ,
"[email protected] " ,
"validpassword123"
798
+ )
799
+ assert response_1 .status_code == 200
800
+ dict_response = json .loads (response_1 .text )
801
+ assert dict_response ["status" ] == "FIELD_ERROR"
802
+ assert len (dict_response ["formFields" ]) == 1
803
+ assert dict_response ["formFields" ][0 ]["error" ] == "Field is not optional"
804
+ assert dict_response ["formFields" ][0 ]["id" ] == "test_field"
805
+
806
+
770
807
# TODO add few more tests
0 commit comments