(t *testing.T)
| 931 | } |
| 932 | |
| 933 | func TestApiCmd_FileWithGET(t *testing.T) { |
| 934 | f, _, _, _ := cmdutil.TestFactory(t, &core.CliConfig{ |
| 935 | AppID: "test-app", AppSecret: "test-secret", Brand: core.BrandFeishu, |
| 936 | }) |
| 937 | cmd := NewCmdApi(f, func(opts *APIOptions) error { |
| 938 | return apiRun(opts) |
| 939 | }) |
| 940 | cmd.SetArgs([]string{"GET", "/open-apis/test", "--as", "bot", "--file", "photo.jpg"}) |
| 941 | err := cmd.Execute() |
| 942 | if err == nil { |
| 943 | t.Fatal("expected error for --file with GET") |
| 944 | } |
| 945 | if !strings.Contains(err.Error(), "requires POST") { |
| 946 | t.Errorf("expected method error, got: %v", err) |
| 947 | } |
| 948 | } |
| 949 | |
| 950 | func TestApiCmd_FileStdinConflictWithData(t *testing.T) { |
| 951 | f, _, _, _ := cmdutil.TestFactory(t, &core.CliConfig{ |
nothing calls this directly
no test coverage detected