@@ -854,8 +854,13 @@ func TestFormFieldsHasNoEmailField(t *testing.T) {
854854
855855 resp .Body .Close ()
856856
857- assert .Equal (t , "Are you sending too many / too few formFields?\n " , string (dataInBytes1 ))
858- assert .Equal (t , 500 , resp .StatusCode )
857+ assert .Equal (t , 400 , resp .StatusCode )
858+
859+ err = json .Unmarshal (dataInBytes1 , & data )
860+ if err != nil {
861+ t .Error (err .Error ())
862+ }
863+ assert .Equal (t , "Are you sending too many / too few formFields?" , data ["message" ].(string ))
859864
860865}
861866
@@ -938,8 +943,12 @@ func TestFormFieldsHasNoPasswordField(t *testing.T) {
938943
939944 resp .Body .Close ()
940945
941- assert .Equal (t , "Are you sending too many / too few formFields?\n " , string (dataInBytes1 ))
942- assert .Equal (t , 500 , resp .StatusCode )
946+ assert .Equal (t , 400 , resp .StatusCode )
947+ err = json .Unmarshal (dataInBytes1 , & data )
948+ if err != nil {
949+ t .Error (err .Error ())
950+ }
951+ assert .Equal (t , "Are you sending too many / too few formFields?" , data ["message" ].(string ))
943952
944953}
945954
@@ -2147,8 +2156,13 @@ func TestFormFieldsAddedInConfigButNotInInputToSignupCheckErrorAboutItBeingMissi
21472156 t .Error (err .Error ())
21482157 }
21492158 res .Body .Close ()
2150- assert .Equal (t , 500 , res .StatusCode )
2151- assert .Equal (t , "Are you sending too many / too few formFields?\n " , string (dataInBytes ))
2159+ assert .Equal (t , 400 , res .StatusCode )
2160+ var data map [string ]interface {}
2161+ err = json .Unmarshal (dataInBytes , & data )
2162+ if err != nil {
2163+ t .Error (err .Error ())
2164+ }
2165+ assert .Equal (t , "Are you sending too many / too few formFields?" , data ["message" ].(string ))
21522166
21532167}
21542168
@@ -2380,16 +2394,19 @@ func TestInputFormFieldWithoutEmailField(t *testing.T) {
23802394 t .Error (err .Error ())
23812395 }
23822396
2383- assert .Equal (t , 500 , resp .StatusCode )
2384-
23852397 dataInBytes , err := io .ReadAll (resp .Body )
23862398 if err != nil {
23872399 t .Error (err .Error ())
23882400 }
23892401 resp .Body .Close ()
23902402
2391- assert .Equal (t , 500 , resp .StatusCode )
2392- assert .Equal (t , "Are you sending too many / too few formFields?\n " , string (dataInBytes ))
2403+ assert .Equal (t , 400 , resp .StatusCode )
2404+ var data map [string ]interface {}
2405+ err = json .Unmarshal (dataInBytes , & data )
2406+ if err != nil {
2407+ t .Error (err .Error ())
2408+ }
2409+ assert .Equal (t , "Are you sending too many / too few formFields?" , data ["message" ].(string ))
23932410
23942411}
23952412
@@ -2444,17 +2461,19 @@ func TestInputFormFieldWithoutPasswordField(t *testing.T) {
24442461 t .Error (err .Error ())
24452462 }
24462463
2447- assert .Equal (t , 500 , resp .StatusCode )
2448-
24492464 dataInBytes , err := io .ReadAll (resp .Body )
24502465 if err != nil {
24512466 t .Error (err .Error ())
24522467 }
24532468 resp .Body .Close ()
24542469
2455- assert .Equal (t , 500 , resp .StatusCode )
2456- assert .Equal (t , "Are you sending too many / too few formFields?\n " , string (dataInBytes ))
2457-
2470+ assert .Equal (t , 400 , resp .StatusCode )
2471+ var data map [string ]interface {}
2472+ err = json .Unmarshal (dataInBytes , & data )
2473+ if err != nil {
2474+ t .Error (err .Error ())
2475+ }
2476+ assert .Equal (t , "Are you sending too many / too few formFields?" , data ["message" ].(string ))
24582477}
24592478
24602479func TestInputFormFieldHasADifferentNumberOfCustomFiledsThanInConfigFormFields (t * testing.T ) {
@@ -2529,16 +2548,19 @@ func TestInputFormFieldHasADifferentNumberOfCustomFiledsThanInConfigFormFields(t
25292548 t .Error (err .Error ())
25302549 }
25312550
2532- assert .Equal (t , 500 , resp .StatusCode )
2533-
25342551 dataInBytes , err := io .ReadAll (resp .Body )
25352552 if err != nil {
25362553 t .Error (err .Error ())
25372554 }
25382555 resp .Body .Close ()
25392556
2540- assert .Equal (t , 500 , resp .StatusCode )
2541- assert .Equal (t , "Are you sending too many / too few formFields?\n " , string (dataInBytes ))
2557+ assert .Equal (t , 400 , resp .StatusCode )
2558+ var data map [string ]interface {}
2559+ err = json .Unmarshal (dataInBytes , & data )
2560+ if err != nil {
2561+ t .Error (err .Error ())
2562+ }
2563+ assert .Equal (t , "Are you sending too many / too few formFields?" , data ["message" ].(string ))
25422564
25432565}
25442566
0 commit comments