Add optional MDBList movie ratings
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user