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
fix(test): update API test expectations for status codes and response format
rcourtmaneec4bcf33e3d
diff --git a/internal/api/config_handlers_add_test.go b/internal/api/config_handlers_add_test.goindex a49e904e53..2b073518c4 100644--- a/internal/api/config_handlers_add_test.go+++ b/internal/api/config_handlers_add_test.go@@ -108,7 +108,7 @@ func TestHandleAddNode(t *testing.T) {"user": "root@pam","password": "secret",},- expectedStatus: http.StatusOK,+ expectedStatus: http.StatusCreated,verifyConfig: func(t *testing.T, c *config.Config) {found := falsefor _, node := range c.PVEInstances {@@ -138,7 +138,7 @@ func TestHandleAddNode(t *testing.T) {"tokenName": "root@pam!token","tokenValue": "abcdef",},- expectedStatus: http.StatusOK,+ expectedStatus: http.StatusCreated,verifyConfig: func(t *testing.T, c *config.Config) {found := falsefor _, node := range c.PVEInstances {diff --git a/internal/api/config_handlers_delete_test.go b/internal/api/config_handlers_delete_test.goindex 5503d861aa..09dd5d67eb 100644--- a/internal/api/config_handlers_delete_test.go+++ b/internal/api/config_handlers_delete_test.go@@ -74,14 +74,13 @@ func TestHandleDeleteNode(t *testing.T) {{name: "fail_invalid_index",nodeID: "pve-999",- expectedStatus: http.StatusBadRequest,+ expectedStatus: http.StatusNotFound,verifyDeletion: nil,},{name: "fail_invalid_type",nodeID: "unknown-0",- expectedStatus: http.StatusBadRequest, // Handler falls through to unknown type log and returns bad request?- // Wait, looking at code: It logs warning "Unknown node type for deletion" and sends 400 "Invalid node ID"+ expectedStatus: http.StatusNotFound, // Handler returns 404 for unknown typesverifyDeletion: nil,},}diff --git a/internal/api/config_handlers_setup_url_test.go b/internal/api/config_handlers_setup_url_test.goindex 9a9ad2b4de..9ce5e841be 100644--- a/internal/api/config_handlers_setup_url_test.go+++ b/internal/api/config_handlers_setup_url_test.go@@ -41,21 +41,18 @@ func TestHandleSetupScriptURL(t *testing.T) {},expectedStatus: http.StatusOK,verifyResponse: func(t *testing.T, resp map[string]interface{}, h *ConfigHandlers) {- if resp["status"] != "success" {- t.Errorf("expected status 'success', got '%v'", resp["status"])- }url, ok := resp["url"].(string)if !ok || url == "" {t.Errorf("expected valid url, got %v", resp["url"])}- token, ok := resp["token"].(string)+ token, ok := resp["setupToken"].(string)if !ok || token == "" {- t.Errorf("expected valid token, got %v", resp["token"])+ t.Errorf("expected valid setupToken, got %v", resp["setupToken"])}- // Verify URL construction uses public URL- if !strings.HasPrefix(url, "https://pulse.example.com") {- t.Errorf("expected public URL prefix, got %s", url)+ // Verify URL construction uses public URL host+ if !strings.Contains(url, "pulse.example.com") {+ t.Errorf("expected URL to contain public host, got %s", url)}},},@@ -72,8 +69,9 @@ func TestHandleSetupScriptURL(t *testing.T) {// But type is used in setupCode struct.expectedStatus: http.StatusOK,verifyResponse: func(t *testing.T, resp map[string]interface{}, h *ConfigHandlers) {- if resp["status"] != "success" {- t.Errorf("expected status 'success', got '%v'", resp["status"])+ // Should still return a valid response even with empty fields+ if _, ok := resp["url"]; !ok {+ t.Errorf("expected url field in response")}},},