(t *testing.T)
| 65 | } |
| 66 | |
| 67 | func TestAPITool_GET(t *testing.T) { |
| 68 | t.Parallel() |
| 69 | ts := getTestServer(t) |
| 70 | |
| 71 | tool := newAPIToolForTest(latest.APIToolConfig{ |
| 72 | Method: http.MethodGet, |
| 73 | Endpoint: ts.serverURL + "/api?key=${key}&value=${value}", |
| 74 | }, testExpander()) |
| 75 | |
| 76 | result, err := tool.callTool(t.Context(), tools.ToolCall{ |
| 77 | Function: tools.FunctionCall{ |
| 78 | Arguments: `{"key": "mykey", "value": "myvalue"}`, |
| 79 | }, |
| 80 | }) |
| 81 | |
| 82 | require.NoError(t, err) |
| 83 | assert.JSONEq(t, `{"status":"ok"}`, result.Output) |
| 84 | assert.Equal(t, http.MethodGet, ts.receivedMethod) |
| 85 | assert.Equal(t, "/api?key=mykey&value=myvalue", ts.receivedURL) |
| 86 | } |
| 87 | |
| 88 | func TestAPITool_POST(t *testing.T) { |
| 89 | t.Parallel() |
nothing calls this directly
no test coverage detected