Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

test: Add edge case for handleServerInfo method not allowed

rcourtmanb2a429655704
diff --git a/internal/api/router_integration_test.go b/internal/api/router_integration_test.go
index 624f178a93..9921f35eb4 100644
--- a/internal/api/router_integration_test.go
+++ b/internal/api/router_integration_test.go
@@ -331,6 +331,25 @@ func TestServerInfoEndpointReportsDevelopment(t *testing.T) {
}
}
+func TestServerInfoEndpointMethodNotAllowed(t *testing.T) {
+ srv := newIntegrationServer(t)
+
+ req, err := http.NewRequest(http.MethodPost, srv.server.URL+"/api/server/info", nil)
+ if err != nil {
+ t.Fatalf("create request failed: %v", err)
+ }
+
+ res, err := http.DefaultClient.Do(req)
+ if err != nil {
+ t.Fatalf("server info POST request failed: %v", err)
+ }
+ defer res.Body.Close()
+
+ if res.StatusCode != http.StatusMethodNotAllowed {
+ t.Fatalf("unexpected status: got %d want %d", res.StatusCode, http.StatusMethodNotAllowed)
+ }
+}
+
func TestConfigNodesUsesMockTopology(t *testing.T) {
srv := newIntegrationServer(t)