Add Memby account management
This commit is contained in:
@@ -163,7 +163,7 @@ func TestServiceStatusAcceptsCurrentProtocol(t *testing.T) {
|
||||
func TestAdminIsDisabledWithoutAToken(t *testing.T) {
|
||||
server := testServer(config.Config{})
|
||||
|
||||
for _, path := range []string{"/admin/", "/admin/api/status"} {
|
||||
for _, path := range []string{"/admin/", "/admin/api/status", "/admin/api/accounts"} {
|
||||
rec := httptest.NewRecorder()
|
||||
server.adminRoutes().ServeHTTP(rec, httptest.NewRequest(http.MethodGet, path, nil))
|
||||
if rec.Code != http.StatusNotFound {
|
||||
@@ -323,7 +323,7 @@ func TestAdminPagesUseRealRoutes(t *testing.T) {
|
||||
AdminToken: "secret", ReleasePublishToken: "release-secret",
|
||||
})
|
||||
for _, page := range []string{
|
||||
"library", "recommendations", "requests", "ratings", "maintenance",
|
||||
"accounts", "library", "recommendations", "requests", "ratings", "maintenance",
|
||||
"updates", "engagement", "imports", "logs",
|
||||
} {
|
||||
req := httptest.NewRequest(http.MethodGet, "/admin/"+page, nil)
|
||||
@@ -349,6 +349,28 @@ func TestAdminPagesUseRealRoutes(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAccountsPageDistinguishesMembyFromEmbyAndProvidesManagement(t *testing.T) {
|
||||
server := testServer(config.Config{
|
||||
AdminToken: "secret", ReleasePublishToken: "release-secret",
|
||||
})
|
||||
req := httptest.NewRequest(http.MethodGet, "/admin/accounts", nil)
|
||||
addInstallerSession(t, server, req)
|
||||
rec := httptest.NewRecorder()
|
||||
|
||||
server.adminRoutes().ServeHTTP(rec, req)
|
||||
|
||||
body := rec.Body.String()
|
||||
for _, wanted := range []string{
|
||||
"This is the Memby account list, not the Emby user directory",
|
||||
"Signed-in devices", "Recommendation prompt", "Remove Memby access",
|
||||
"Clear stored choices",
|
||||
} {
|
||||
if !strings.Contains(body, wanted) {
|
||||
t.Fatalf("accounts page does not contain %q", wanted)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMDBListAdminStatusNeverExposesTheAPIKey(t *testing.T) {
|
||||
view := publicMDBListSettings(store.MDBListSettings{
|
||||
Enabled: true, APIKey: "super-secret", Sources: []string{"imdb"},
|
||||
|
||||
Reference in New Issue
Block a user