TestConfigHandlerRemoveKnownKeys validates that configHandler removes "_knownkeys" keys properly, still resulting in a valid JSON document.
(t *testing.T)
| 487 | // TestConfigHandlerRemoveKnownKeys validates that configHandler removes |
| 488 | // "_knownkeys" keys properly, still resulting in a valid JSON document. |
| 489 | func TestConfigHandlerRemoveKnownKeys(t *testing.T) { |
| 490 | config := serverinit.ExportNewConfigFromObj(jsonconfig.Obj{ |
| 491 | "/ui/": "", |
| 492 | "_knownkeys": map[string]string{ |
| 493 | "key": "value", |
| 494 | }, |
| 495 | }) |
| 496 | |
| 497 | rr := httptest.NewRecorder() |
| 498 | serverinit.ConfigHandler(config).ServeHTTP(rr, nil) |
| 499 | got := make(map[string]string) |
| 500 | if err := json.Unmarshal(rr.Body.Bytes(), &got); err != nil { |
| 501 | t.Fatalf("Failed to unmarshal configHandler response: %v", err) |
| 502 | } |
| 503 | want := map[string]string{ |
| 504 | "/ui/": "", |
| 505 | } |
| 506 | |
| 507 | compareConfigurations(t, "configHandlerRemoveKnownKeys", got, want) |
| 508 | } |
nothing calls this directly
no test coverage detected