Files
-Fonu/internal/nginx/htpasswd_hash_test.go
T

20 lines
444 B
Go
Raw Normal View History

2026-09-23 09:40:59 +08:00
package nginx
import "testing"
func TestNginxHtpasswdHashNormalizesBcryptPrefix(t *testing.T) {
in := "$2a$10$abcdefghijklmnopqrstuv"
got := nginxHtpasswdHash(in)
want := "$2y$10$abcdefghijklmnopqrstuv"
if got != want {
t.Fatalf("got %q want %q", got, want)
}
}
func TestNginxHtpasswdHashLeavesOtherFormats(t *testing.T) {
in := "$apr1$abc123"
if got := nginxHtpasswdHash(in); got != in {
t.Fatalf("got %q want %q", got, in)
}
}