@@ -48,6 +48,15 @@ func (ts *VerifyTestSuite) SetupTest() {
48
48
u ,
err := models .
NewUser (
"12345678" ,
"[email protected] " ,
"password" ,
ts .
Config .
JWT .
Aud ,
nil )
49
49
require .NoError (ts .T (), err , "Error creating test user model" )
50
50
require .NoError (ts .T (), ts .API .db .Create (u ), "Error saving new test user" )
51
+
52
+ // Create identity
53
+ i , err := models .NewIdentity (u , "email" , map [string ]interface {}{
54
+ "sub" : u .ID .String (),
55
+
56
+ "email_verified" : false ,
57
+ })
58
+ require .NoError (ts .T (), err , "Error creating test identity model" )
59
+ require .NoError (ts .T (), ts .API .db .Create (i ), "Error saving new test identity" )
51
60
}
52
61
53
62
func (ts * VerifyTestSuite ) TestVerifyPasswordRecovery () {
@@ -673,6 +682,8 @@ func (ts *VerifyTestSuite) TestVerifySignupWithRedirectURLContainedPath() {
673
682
u ,
err = models .
FindUserByEmailAndAudience (
ts .
API .
db ,
"[email protected] " ,
ts .
Config .
JWT .
Aud )
674
683
require .NoError (ts .T (), err )
675
684
assert .True (ts .T (), u .IsConfirmed ())
685
+ assert .True (ts .T (), u .UserMetaData ["email_verified" ].(bool ))
686
+ assert .True (ts .T (), u .Identities [0 ].IdentityData ["email_verified" ].(bool ))
676
687
})
677
688
}
678
689
}
@@ -875,6 +886,18 @@ func (ts *VerifyTestSuite) TestVerifyValidOtp() {
875
886
tokenHash : crypto .GenerateTokenHash (u .GetEmail (), "123456" ),
876
887
},
877
888
},
889
+ {
890
+ desc : "Valid Signup Token Hash" ,
891
+ sentTime : time .Now (),
892
+ body : map [string ]interface {}{
893
+ "type" : mail .SignupVerification ,
894
+ "token_hash" : crypto .GenerateTokenHash (u .GetEmail (), "123456" ),
895
+ },
896
+ expected : expected {
897
+ code : http .StatusOK ,
898
+ tokenHash : crypto .GenerateTokenHash (u .GetEmail (), "123456" ),
899
+ },
900
+ },
878
901
{
879
902
desc : "Valid Recovery OTP" ,
880
903
sentTime : time .Now (),
@@ -940,18 +963,6 @@ func (ts *VerifyTestSuite) TestVerifyValidOtp() {
940
963
tokenHash : crypto .GenerateTokenHash (u .PhoneChange , "123456" ),
941
964
},
942
965
},
943
- {
944
- desc : "Valid Signup Token Hash" ,
945
- sentTime : time .Now (),
946
- body : map [string ]interface {}{
947
- "type" : mail .SignupVerification ,
948
- "token_hash" : crypto .GenerateTokenHash (u .GetEmail (), "123456" ),
949
- },
950
- expected : expected {
951
- code : http .StatusOK ,
952
- tokenHash : crypto .GenerateTokenHash (u .GetEmail (), "123456" ),
953
- },
954
- },
955
966
{
956
967
desc : "Valid Email Change Token Hash" ,
957
968
sentTime : time .Now (),
0 commit comments