MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestSlashModelSwitchesActive

Function TestSlashModelSwitchesActive

internal/tui/tui_test.go:593–615  ·  view source on GitHub ↗

TestSlashModelSwitchesActive: /models sets Active and rebuilds the llm client's base URL / token / model to the new profile's values.

(t *testing.T)

Source from the content-addressed store, hash-verified

591func TestSlashModelSwitchesActive(t *testing.T) {
592 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
593 m.cfg.Models["remote"] = &config.Profile{
594 LLM: "cloud-model", URL: "http://remote:9000", Key: "sk-r", ContextSize: 200000,
595 }
596 if err := m.cfg.Save(); err != nil {
597 t.Fatal(err)
598 }
599 m2, _ := m.runSlash("/models remote")
600 final := m2.(Model)
601 if final.cfg.Active != "remote" {
602 t.Fatalf("Active should be 'remote', got %q", final.cfg.Active)
603 }
604 if final.cli.BaseURL != "http://remote:9000" {
605 t.Fatalf("client.BaseURL not rebuilt: %q", final.cli.BaseURL)
606 }
607 if final.cli.Model != "cloud-model" {
608 t.Fatalf("client.Model not rebuilt: %q", final.cli.Model)
609 }
610 if final.cli.Token != "sk-r" {
611 t.Fatalf("client.Token not rebuilt: %q", final.cli.Token)
612 }
613}
614
615// TestDebugLogFilePermsAreOwnerOnly: the log captures every prompt and tool call
616// payload: bash args can carry heredoc secrets, so a world readable log leaks
617// them. 0o600 only.
618func TestDebugLogFilePermsAreOwnerOnly(t *testing.T) {

Callers

nothing calls this directly

Calls 3

newTestModelFunction · 0.85
SaveMethod · 0.80
runSlashMethod · 0.80

Tested by

no test coverage detected