(t *testing.T)
| 134 | } |
| 135 | |
| 136 | func TestAPIClient_PUT(t *testing.T) { |
| 137 | mock := testutil.NewMockAPI() |
| 138 | defer mock.Close() |
| 139 | |
| 140 | mock.On("PUT", "/groups/prod", 200, `{"key":"prod","name":"Updated"}`) |
| 141 | |
| 142 | client := newTestClient(mock.Server.URL) |
| 143 | body := []byte(`{"name":"Updated"}`) |
| 144 | resp, err := client.PUT("/groups/prod", body, nil) |
| 145 | if err != nil { |
| 146 | t.Fatalf("unexpected error: %v", err) |
| 147 | } |
| 148 | |
| 149 | if resp.StatusCode != 200 { |
| 150 | t.Errorf("expected status 200, got %d", resp.StatusCode) |
| 151 | } |
| 152 | |
| 153 | req := mock.LastRequest() |
| 154 | if req.Method != "PUT" { |
| 155 | t.Errorf("expected PUT, got %s", req.Method) |
| 156 | } |
| 157 | if req.Path != "/groups/prod" { |
| 158 | t.Errorf("expected /groups/prod, got %s", req.Path) |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | func TestAPIClient_DELETE(t *testing.T) { |
| 163 | mock := testutil.NewMockAPI() |
nothing calls this directly
no test coverage detected