TestHamrpassLazyCreatesProfile: a user who hid hamrpass from config.yaml can still activate it by pasting a key. /hamrpass creates the profile from canonical seed values, stores the key, and flips active.
(t *testing.T)
| 2989 | if final.cfg.Active != "hamrpass" { |
| 2990 | t.Fatalf("active should switch to hamrpass, got %q", final.cfg.Active) |
| 2991 | } |
| 2992 | if got := final.cfg.Models["hamrpass"].Key; got != key { |
| 2993 | t.Fatalf("key not stored: %q", got) |
| 2994 | } |
| 2995 | if final.cli.Token != key { |
| 2996 | t.Fatalf("llm client token not rebuilt: %q", final.cli.Token) |
| 2997 | } |
| 2998 | if final.cli.Model != "hamrpass" { |
| 2999 | t.Fatalf("llm client model not rebuilt: %q", final.cli.Model) |
| 3000 | } |
| 3001 | if cmd == nil { |
| 3002 | t.Fatal("set should return a probeBackend command") |
| 3003 | } |
| 3004 | // Activation defers the success line until probeMsg arrives; synchronous |
| 3005 | // scrollback shows the "▶ probing" placeholder. The "✓ active" line is |
| 3006 | // exercised in TestHandleProbeSuccessUpdatesLiveCtxAndPrintsActivation. |
| 3007 | out := stripANSI(final.scroll.String()) |
| 3008 | if !strings.Contains(out, "▶ probing hamrpass") { |
| 3009 | t.Fatalf("expected probing placeholder in scrollback:\n%s", out) |
| 3010 | } |
| 3011 | } |
| 3012 | |
| 3013 | // TestHamrpassLazyCreatesProfile: a user who hid hamrpass from config.yaml can |
| 3014 | // still activate it by pasting a key. /hamrpass <key> creates the profile from |
| 3015 | // canonical seed values, stores the key, and flips active. |
| 3016 | func TestHamrpassLazyCreatesProfile(t *testing.T) { |
| 3017 | m := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 3018 | delete(m.cfg.Models, "hamrpass") |
| 3019 | // Persist the deletion so runSlash's reload sees a hamrpass-less config, |
| 3020 | // else the on-disk seed slips back in and the lazy-create path never fires. |
| 3021 | if err := m.cfg.Save(); err != nil { |
| 3022 | t.Fatal(err) |
| 3023 | } |
| 3024 | if _, ok := m.cfg.Models["hamrpass"]; ok { |
nothing calls this directly
no test coverage detected