Sync shared snapshot from c5c3ec3
Docker / Docker Build & Push (push) Successful in 5m6s

This commit is contained in:
Gabriel20xx committed 2026-09-07 16:00:55 +02:00
1 parent fdf415cc8b
commit 5f0524ed3c
80 files changed
+1152 -16598

No files matched your search

File diff suppressed because it is too large. Load diff
+28
View File
@@ -0,0 +1,28 @@
package mediaauth
import "testing"
func TestNormalizeCredentials(t *testing.T) {
email, username, password, err := normalizeCredentials(" User@Example.com ", "user", "correct horse battery staple")
if err != nil {
t.Fatal(err)
}
if email != "user@example.com" || username != "user" || password == "" {
t.Fatalf("normalized credentials = %q, %q, %q", email, username, password)
}
}
func TestNormalizeCredentialsAllowsAdminEmailOnly(t *testing.T) {
if _, _, _, err := normalizeCredentials("admin@example.com", "", "correct horse battery staple"); err != nil {
t.Fatalf("empty optional username rejected: %v", err)
}
}
func TestNormalizeRole(t *testing.T) {
if normalizeRole("MODERATOR") != "moderator" {
t.Fatal("moderator role was not normalized")
}
if normalizeRole("unknown") != "user" {
t.Fatal("unknown role was not reduced to user")
}
}