Add optional MDBList movie ratings

This commit is contained in:
ponzischeme89
2026-08-03 08:55:52 +12:00
parent b6b2a9c25a
commit 666da9c5d3
18 changed files with 840 additions and 4 deletions
+14 -1
View File
@@ -323,7 +323,7 @@ func TestAdminPagesUseRealRoutes(t *testing.T) {
AdminToken: "secret", ReleasePublishToken: "release-secret",
})
for _, page := range []string{
"library", "recommendations", "requests", "maintenance",
"library", "recommendations", "requests", "ratings", "maintenance",
"updates", "engagement", "imports", "logs",
} {
req := httptest.NewRequest(http.MethodGet, "/admin/"+page, nil)
@@ -349,6 +349,19 @@ func TestAdminPagesUseRealRoutes(t *testing.T) {
}
}
func TestMDBListAdminStatusNeverExposesTheAPIKey(t *testing.T) {
view := publicMDBListSettings(store.MDBListSettings{
Enabled: true, APIKey: "super-secret", Sources: []string{"imdb"},
})
body, err := json.Marshal(view)
if err != nil {
t.Fatal(err)
}
if strings.Contains(string(body), "super-secret") || !strings.Contains(string(body), `"apiKeyConfigured":true`) {
t.Fatalf("unsafe MDBList admin payload: %s", body)
}
}
func TestInstallerDestinationAllowsOnlyKnownAdminPages(t *testing.T) {
if got := cleanInstallerDestination("/admin/recommendations"); got != "/admin/recommendations" {
t.Fatalf("recommendation destination = %q", got)