(t *testing.T)
| 176 | } |
| 177 | |
| 178 | func TestAPI_NotFound(t *testing.T) { |
| 179 | _, _ = iostreams.SetForTest(t) |
| 180 | cli, stop := newTestClient(t, func(w http.ResponseWriter, r *http.Request) { |
| 181 | w.WriteHeader(http.StatusNotFound) |
| 182 | _, _ = w.Write([]byte(`{"error":"missing"}`)) |
| 183 | }) |
| 184 | defer stop() |
| 185 | |
| 186 | err := runAPI(context.Background(), &Options{}, &cmdutil.FormatOptions{Mode: cmdutil.FormatText}, cli, "GET", "/api/v1/missing", false) |
| 187 | if err == nil { |
| 188 | t.Fatal("expected error for 404") |
| 189 | } |
| 190 | if !cmdutil.IsNotFound(err) { |
| 191 | t.Errorf("expected resource.not_found, got %v", err) |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | func TestAPI_AcceptsArbitraryMethod(t *testing.T) { |
| 196 | _, _ = iostreams.SetForTest(t) |
nothing calls this directly
no test coverage detected