| 1 | package equipo |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "testing" |
| 6 | |
| 7 | "amadan.net/oficina/equipo/internal/equipo/team" |
| 8 | ) |
| 9 | |
| 10 | func TestSupervisedReceiptProvider(t *testing.T) { |
| 11 | for _, tc := range []struct { |
| 12 | step, provider, model string |
| 13 | accept bool |
| 14 | }{ |
| 15 | {"publish", "amadan", "", true}, |
| 16 | {"publish", "claude", "sonnet", false}, |
| 17 | {"publish", "amadan", "sonnet", false}, |
| 18 | {"implement", "amadan", "", false}, |
| 19 | {"implement", "claude", "sonnet", true}, |
| 20 | {"implement", "claude", "other", false}, |
| 21 | } { |
| 22 | t.Run(tc.step+"/"+tc.provider+"/"+tc.model, func(t *testing.T) { |
| 23 | a := Assignment{ID: "assignment", StepKey: tc.step, Selection: Selection{Provider: "claude", Model: "sonnet"}} |
| 24 | q := RunnerRequest{AssignmentID: a.ID, Receipt: &team.Receipt{Provider: tc.provider, Model: tc.model}} |
| 25 | _, err := instanceValidators().Receipt(context.Background(), a, q) |
| 26 | if (err == nil) != tc.accept { |
| 27 | t.Fatalf("receipt acceptance=%t want %t: %v", err == nil, tc.accept, err) |
| 28 | } |
| 29 | q.AssignmentID = "foreign" |
| 30 | if _, err = instanceValidators().Receipt(context.Background(), a, q); err == nil { |
| 31 | t.Fatal("foreign assignment receipt accepted") |
| 32 | } |
| 33 | }) |
| 34 | } |
| 35 | } |
| 36 | |