| 1 | package workbench |
| 2 | |
| 3 | import ( |
| 4 | "net/http" |
| 5 | "net/http/httptest" |
| 6 | "strings" |
| 7 | "testing" |
| 8 | |
| 9 | "github.com/sylvinus/agent-vm/internal/guestos" |
| 10 | ) |
| 11 | |
| 12 | func TestMacOSClaudeRouteCannotRequestProjectPanel(t *testing.T) { |
| 13 | s := testServer(t) |
| 14 | body := `{"action":"project-frame","project":"/Users/guest/Cage/Projects/aaaaaaaaaaaaaaaaaaaaaaaa"}` |
| 15 | |
| 16 | for _, test := range []struct { |
| 17 | profile *guestos.MacOSProfile |
| 18 | status int |
| 19 | }{ |
| 20 | {nil, http.StatusNotFound}, |
| 21 | {&guestos.MacOSProfile{Instance: "mac", User: "guest"}, http.StatusBadRequest}, |
| 22 | } { |
| 23 | s.macosGuest = test.profile |
| 24 | response := httptest.NewRecorder() |
| 25 | request := httptest.NewRequest(http.MethodPost, "/api/macos/claude/window", strings.NewReader(body)) |
| 26 | request.Header.Set("Content-Type", "application/json") |
| 27 | s.macOSClaudeWindow(response, request) |
| 28 | if response.Code != test.status { |
| 29 | t.Fatalf("got %d, want %d", response.Code, test.status) |
| 30 | } |
| 31 | } |
| 32 | } |