Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
accountserver
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai3
accountserver
Commits
c5f2b0c3
Commit
c5f2b0c3
authored
Jun 23, 2019
by
ale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a simple account recovery test
parent
336cd671
Pipeline
#3557
passed with stages
in 5 minutes and 6 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
22 deletions
+24
-22
actions_test.go
actions_test.go
+24
-22
No files found.
actions_test.go
View file @
c5f2b0c3
...
...
@@ -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
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment