Commit c5f2b0c3 authored by ale's avatar ale

Add a simple account recovery test

parent 336cd671
Pipeline #3557 passed with stages
in 5 minutes and 6 seconds
......@@ -751,26 +751,28 @@ func TestService_ResetResourcePassword(t *testing.T) {
}
}
// func TestService_Recovery(t *testing.T) {
// svc := testService("")
// // Bad recovery response.
// _, err := svc.RecoverPassword(context.Background(), tx, &AccountRecoveryRequest{
// Username: testUser,
// RecoveryPassword: "BADPASS",
// Password: "new_password",
// })
// if err == nil {
// t.Fatal("oops, recovered account with bad password")
// }
func TestService_AccountRecovery(t *testing.T) {
svc := testService("")
// // Successful account recovery.
// _, err = svc.RecoverPassword(context.Background(), tx, &AccountRecoveryRequest{
// Username: testUser,
// RecoveryPassword: "recoverypassword",
// Password: "new_password",
// })
// if err != nil {
// t.Fatalf("RecoverPassword failed: %v", err)
// }
// }
// Bad recovery response.
req := &AccountRecoveryRequest{
Username: testUser,
RecoveryPassword: "BADPASS",
Password: "new_password",
}
_, err := svc.Handle(context.TODO(), req)
if err == nil {
t.Fatal("oops, recovered account with bad password")
}
// Successful account recovery.
req = &AccountRecoveryRequest{
Username: testUser,
RecoveryPassword: "recoverypassword",
Password: "new_password",
}
_, err = svc.Handle(context.TODO(), req)
if err != nil {
t.Fatalf("account recovery failed: %v", err)
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment