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

Function TestApiCmd_FileStdinConflictWithData

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

Source from the content-addressed store, hash-verified

948}
949
950func TestApiCmd_FileStdinConflictWithData(t *testing.T) {
951 f, _, _, _ := cmdutil.TestFactory(t, &core.CliConfig{
952 AppID: "test-app", AppSecret: "test-secret", Brand: core.BrandFeishu,
953 })
954 cmd := NewCmdApi(f, func(opts *APIOptions) error {
955 return apiRun(opts)
956 })
957 cmd.SetArgs([]string{"POST", "/open-apis/test", "--as", "bot", "--file", "-", "--data", "-"})
958 err := cmd.Execute()
959 if err == nil {
960 t.Fatal("expected error for --file stdin with --data stdin")
961 }
962 if !strings.Contains(err.Error(), "cannot both read from stdin") {
963 t.Errorf("expected stdin conflict error, got: %v", err)
964 }
965}
966
967func TestApiCmd_DryRunWithFile(t *testing.T) {
968 tmpDir := t.TempDir()

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