mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 15:03:09 -06:00
Delete test/password_validation_test.go
This commit is contained in:
parent
f438f7cbcd
commit
66a47f7bca
|
|
@ -1,33 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import "testing"
|
|
||||||
|
|
||||||
func TestValidatePassword(t *testing.T) {
|
|
||||||
tests := []struct {
|
|
||||||
password string
|
|
||||||
config PasswordConfig
|
|
||||||
expectErr bool
|
|
||||||
}{
|
|
||||||
// Test cases for length
|
|
||||||
{"short", defaultPasswordConfig, true},
|
|
||||||
{"longEnoughPassword1!", defaultPasswordConfig, false},
|
|
||||||
{string(make([]byte, maxPasswordLength+1)), defaultPasswordConfig, true},
|
|
||||||
|
|
||||||
// Test cases for character requirements
|
|
||||||
{"NoDigitsOrSpecialChars", defaultPasswordConfig, true},
|
|
||||||
{"WithDigits1", defaultPasswordConfig, true},
|
|
||||||
{"WithSpecialChars!", defaultPasswordConfig, true},
|
|
||||||
{"ValidP@ssw0rd", defaultPasswordConfig, false},
|
|
||||||
|
|
||||||
// Custom config examples
|
|
||||||
{"NoSpecialChar123", PasswordConfig{minPasswordLength, maxPasswordLength, true, true, true, false}, false},
|
|
||||||
{"alllowercase1!", PasswordConfig{minPasswordLength, maxPasswordLength, false, true, true, true}, false},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
|
||||||
err := ValidatePassword(tt.password, tt.config)
|
|
||||||
if (err != nil) != tt.expectErr {
|
|
||||||
t.Errorf("ValidatePassword(%s) = %v, expected error = %v", tt.password, err, tt.expectErr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue