Keepers 8ba79709a6
split tester into separate files (#3762)
This is primarily an exercise in reducing the number of circular imports we get from adding the tester package to other packages.

No logic changes.  Purely movement/renaming.

---

#### Does this PR need a docs update or release note?

- [x]  No

#### Type of change

- [x] 🤖 Supportability/Tests

#### Test Plan

- [x]  Unit test
- [x] 💚 E2E
2023-07-06 15:43:57 +00:00

32 lines
651 B
Go

package testdata
import (
"fmt"
"time"
"github.com/google/uuid"
"github.com/spf13/cobra"
"github.com/alcionai/corso/src/internal/common/dttm"
)
// StubRootCmd builds a stub cobra command to be used as
// the root command for integration testing on the CLI
func StubRootCmd(args ...string) *cobra.Command {
id := uuid.NewString()
now := dttm.Format(time.Now())
cmdArg := "testing-corso"
c := &cobra.Command{
Use: cmdArg,
Short: id,
Long: id + " - " + now,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Fprintf(cmd.OutOrStdout(), "test command args: %+v", args)
return nil
},
}
c.SetArgs(args)
return c
}