- Add /api/v1/watchdog to enable/disable - Scheduled task now runs every 15 minutes - Use schtasks command line instead of XML - Dashboard shows watchdog enabled state - Preserve watchdog state during install
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package openapi
|
|
|
|
import "testing"
|
|
|
|
func TestSpec(t *testing.T) {
|
|
spec := Spec()
|
|
if spec["openapi"] != "3.0.3" {
|
|
t.Fatalf("openapi version = %v", spec["openapi"])
|
|
}
|
|
paths, ok := spec["paths"].(map[string]any)
|
|
if !ok || len(paths) < 12 {
|
|
t.Fatalf("expected at least 12 paths, got %d", len(paths))
|
|
}
|
|
if _, ok := paths["/api/v1/watchdog"]; !ok {
|
|
t.Fatal("missing /api/v1/watchdog")
|
|
}
|
|
if _, ok := spec["security"]; !ok {
|
|
t.Fatal("missing security")
|
|
}
|
|
components, ok := spec["components"].(map[string]any)
|
|
if !ok {
|
|
t.Fatal("missing components")
|
|
}
|
|
if _, ok := components["securitySchemes"]; !ok {
|
|
t.Fatal("missing securitySchemes")
|
|
}
|
|
schemas, ok := components["schemas"].(map[string]any)
|
|
if !ok || len(schemas) < 10 {
|
|
t.Fatalf("expected schemas, got %d", len(schemas))
|
|
}
|
|
status, ok := schemas["Status"].(map[string]any)
|
|
if !ok {
|
|
t.Fatal("missing Status schema")
|
|
}
|
|
props, ok := status["properties"].(map[string]any)
|
|
if !ok {
|
|
t.Fatal("missing Status properties")
|
|
}
|
|
if _, ok := props["klogging"]; !ok {
|
|
t.Fatal("Status missing klogging")
|
|
}
|
|
if _, ok := props["keylog_enabled"]; ok {
|
|
t.Fatal("Status still has keylog_enabled")
|
|
}
|
|
}
|