MCPcopy
hub / github.com/larksuite/cli / TestApiCmd_FileWithGET

Function TestApiCmd_FileWithGET

cmd/api/api_test.go:933–948  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

931}
932
933func 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
950func TestApiCmd_FileStdinConflictWithData(t *testing.T) {
951 f, _, _, _ := cmdutil.TestFactory(t, &core.CliConfig{

Callers

nothing calls this directly

Calls 5

TestFactoryFunction · 0.92
NewCmdApiFunction · 0.85
apiRunFunction · 0.85
ContainsMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected