(t *testing.T)
| 227 | } |
| 228 | |
| 229 | func TestAPI_PathWithoutSlash(t *testing.T) { |
| 230 | _, _ = iostreams.SetForTest(t) |
| 231 | err := runAPI(context.Background(), &Options{}, &cmdutil.FormatOptions{Mode: cmdutil.FormatText}, nil, "GET", "api/v1/things", false) |
| 232 | if err == nil { |
| 233 | t.Fatal("expected error for missing leading slash") |
| 234 | } |
| 235 | var ce *cmdutil.Error |
| 236 | if !asTypedError(err, &ce) || ce.Code != cmdutil.CodeInputInvalidArgument { |
| 237 | t.Errorf("expected input.invalid_argument, got %v", err) |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | // withRootHarness wraps `weknora api ...` under a synthetic root cmd that |
| 242 | // registers the global persistent flags (mirrors addGlobalFlags in |
nothing calls this directly
no test coverage detected