oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package pi
2
3import (
4 "encoding/json"
5 "path/filepath"
6 "strings"
7 "testing"
8)
9
10// fakepi in the real containment: a Review run reaches its one Equipo
11// tool through the tool socket, reports its usage and ends.
12func TestPiFakeReviewInNamespace(t *testing.T) {
13 h := newHarness(t, fakeInstall(t))
14 work := t.TempDir()
15 r := h.open(work, "inspect", []string{"submit_review", "ask_person"}, "")
16 evs := r.prompt(t, "[Equipo: review] Review this.", "deny")
17 tally := &Tally{}
18 for _, e := range evs {
19 tally.Add(e)
20 }
21 row := tally.Row()
22 if !row.Complete || row.Model != "z-ai/glm-5.3" || *row.InputTokens != 200 {
23 t.Fatalf("usage %+v; events %v", row, kinds(evs))
24 }
25 calls := r.tools.called()
26 if len(calls) != 1 || !strings.HasPrefix(calls[0], "submit_review ") {
27 t.Fatalf("tool calls %v", calls)
28 }
29 var done Done
30 json.Unmarshal(evs[len(evs)-1].Payload, &done)
31 if done.Status != StatusCompleted {
32 t.Fatalf("done %+v", done)
33 }
34 if err := r.stop(t); err != nil {
35 t.Fatalf("exit not proven: %v", err)
36 }
37 kept := filepath.Join(t.TempDir(), "kept")
38 if n, err := KeepSession(r.home, r.session.ID, kept); err != nil || n == 0 || !HasSession(kept, r.session.ID) {
39 t.Fatalf("session not kept: %d %v", n, err)
40 }
41}
42