MCPcopy Index your code
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

591// TestSlashModelSwitchesActive: /models <name> sets Active and rebuilds the
592// llm client's base URL / token / model to the new profile's values.
593func TestSlashModelSwitchesActive(t *testing.T) {
594 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
595 m.cfg.Models["remote"] = &config.Profile{
596 LLM: "cloud-model", URL: "http://remote:9000", Key: "sk-r", ContextSize: 200000,
597 }
598 if err := m.cfg.Save(); err != nil {
599 t.Fatal(err)
600 }
601 m2, _ := m.runSlash("/models remote")
602 final := m2.(Model)
603 if final.cfg.Active != "remote" {
604 t.Fatalf("Active should be 'remote', got %q", final.cfg.Active)
605 }
606 if final.cli.BaseURL != "http://remote:9000" {
607 t.Fatalf("client.BaseURL not rebuilt: %q", final.cli.BaseURL)
608 }
609 if final.cli.Model != "cloud-model" {
610 t.Fatalf("client.Model not rebuilt: %q", final.cli.Model)
611 }
612 if final.cli.Token != "sk-r" {
613 t.Fatalf("client.Token not rebuilt: %q", final.cli.Token)
614 }
615}
616
617// TestRedactSlashHidesHamrpassKey: with `logging: true`, every prompt (including
618// `/hamrpass <key>`) is written to .codehamr/log.txt. The log is meant to be

Callers

nothing calls this directly

Calls 3

newTestModelFunction · 0.85
SaveMethod · 0.80
runSlashMethod · 0.80

Tested by

no test coverage detected