mirror of
https://github.com/miniflux/v2.git
synced 2024-08-29 02:36:03 +02:00
![Peter De Wachter](/assets/img/avatar_default.png)
Firefox autocompletes the password field (but not the password confirmation field) for me. This makes it annoying to use the settings page, because miniflux thinks I'm trying to change my password and complains that the fields don't match.
61 lines
1.1 KiB
Go
61 lines
1.1 KiB
Go
package form // import "miniflux.app/ui/form"
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestValid(t *testing.T) {
|
|
settings := &SettingsForm{
|
|
Username: "user",
|
|
Password: "hunter2",
|
|
Confirmation: "hunter2",
|
|
Theme: "default",
|
|
Language: "en_US",
|
|
Timezone: "UTC",
|
|
EntryDirection: "asc",
|
|
}
|
|
|
|
err := settings.Validate()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func TestConfirmationEmpty(t *testing.T) {
|
|
settings := &SettingsForm{
|
|
Username: "user",
|
|
Password: "hunter2",
|
|
Confirmation: "",
|
|
Theme: "default",
|
|
Language: "en_US",
|
|
Timezone: "UTC",
|
|
EntryDirection: "asc",
|
|
}
|
|
|
|
err := settings.Validate()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
if settings.Password != "" {
|
|
t.Error("Password should have been cleared")
|
|
}
|
|
}
|
|
|
|
func TestConfirmationIncorrect(t *testing.T) {
|
|
settings := &SettingsForm{
|
|
Username: "user",
|
|
Password: "hunter2",
|
|
Confirmation: "unter2",
|
|
Theme: "default",
|
|
Language: "en_US",
|
|
Timezone: "UTC",
|
|
EntryDirection: "asc",
|
|
}
|
|
|
|
err := settings.Validate()
|
|
if err == nil {
|
|
t.Error("Validate should return an error")
|
|
}
|
|
}
|