-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test_: add test for VerifyDatabasePasswordV2
- Loading branch information
Showing
2 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package requests | ||
|
||
import "testing" | ||
|
||
func TestVerifyDatabasePasswordV2Validate(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
request VerifyDatabasePasswordV2 | ||
wantErr error | ||
}{ | ||
{ | ||
name: "Empty KeyUID", | ||
request: VerifyDatabasePasswordV2{KeyUID: "", Password: "password"}, | ||
wantErr: ErrVerifyDatabasePasswordV2EmptyKeyUID, | ||
}, | ||
{ | ||
name: "Empty Password", | ||
request: VerifyDatabasePasswordV2{KeyUID: "keyuid", Password: ""}, | ||
wantErr: ErrVerifyDatabasePasswordV2EmptyPassword, | ||
}, | ||
{ | ||
name: "Valid Request", | ||
request: VerifyDatabasePasswordV2{KeyUID: "keyuid", Password: "password"}, | ||
wantErr: nil, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
err := tt.request.Validate() | ||
if err != tt.wantErr { | ||
t.Errorf("VerifyDatabasePasswordV2.Validate() error = %v, wantErr %v", err, tt.wantErr) | ||
} | ||
}) | ||
} | ||
} |