Files
minstrel/internal/subsonic/auth_test.go
T
bvandeusenandClaude Opus 5.5 10b10b8179
release / web (push) Successful in 1m35s
release / go (push) Successful in 1m58s
release / govulncheck (push) Successful in 19s
release / integration (push) Successful in 3m0s
release / android (push) Successful in 4m26s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Publish the release image to GHCR (dispatch only) (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / Build signed APK (push) Canceled after 5m8s
test(coverart, subsonic, server): merge repeated cases into tables (#8298)
- coverart: the four providers' identity and default tests, Last.fm's five
  not-found-without-asking tests, the four "which artists are asked again"
  database tests (now one reset over four artists), and the thumbnail-only
  and fanart-only tests.
- subsonic: getUser's six tests and decodePassword's three, one table each.
  Dropped TestTokenMD5Derivation: it checked crypto/md5 against a constant
  and called no Minstrel code.
- server: the four web-app-versus-API path tests start one server, not four.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 13:58:07 -05:00

22 lines
590 B
Go

package subsonic
import "testing"
// A Subsonic app sends its password as plain text or hex-encoded behind
// "enc:"; malformed hex is an error rather than a wrong password.
func TestDecodePassword(t *testing.T) {
for _, tc := range []struct {
in, want string
err bool
}{
{"enc:68656c6c6f", "hello", false},
{"hunter2", "hunter2", false},
{"enc:zzzz", "", true},
} {
out, err := decodePassword(tc.in)
if (err != nil) != tc.err || (!tc.err && out != tc.want) {
t.Errorf("decodePassword(%q) = %q, %v; want %q (error %v)", tc.in, out, err, tc.want, tc.err)
}
}
}