Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
test: Add edge case for ensureSettingsWriteScope valid scope
rcourtman57e97c3ec1b5
diff --git a/internal/api/security_setup_fix_test.go b/internal/api/security_setup_fix_test.goindex f75679093b..17203bb6b4 100644--- a/internal/api/security_setup_fix_test.go+++ b/internal/api/security_setup_fix_test.go@@ -418,6 +418,37 @@ func TestResetLockoutRequiresSettingsScope(t *testing.T) {}}+func TestEnsureSettingsWriteScopeWithValidScope(t *testing.T) {+ dataDir := t.TempDir()++ rawToken := strings.Repeat("ab", 32)+ record, err := config.NewAPITokenRecord(rawToken, "admin-token", []string{config.ScopeSettingsWrite})+ if err != nil {+ t.Fatalf("new token record: %v", err)+ }++ cfg := &config.Config{+ DataPath: dataDir,+ ConfigPath: dataDir,+ APITokens: []config.APITokenRecord{*record},+ APITokenEnabled: true,+ }+ cfg.SortAPITokens()++ req := httptest.NewRequest(http.MethodPost, "/api/security/test", nil)+ attachAPITokenRecord(req, record)++ rr := httptest.NewRecorder()+ result := ensureSettingsWriteScope(rr, req)++ if !result {+ t.Error("ensureSettingsWriteScope should return true when token has settings:write scope")+ }+ if rr.Code != http.StatusOK {+ t.Errorf("expected no error response, got status %d", rr.Code)+ }+}+func TestValidateBcryptHash(t *testing.T) {tests := []struct {name string