MCPcopy Create free account
hub / github.com/algolia/cli / newOpts

Function newOpts

pkg/cmd/application/update/update_test.go:53–80  ·  view source on GitHub ↗
(
	t *testing.T,
	srv *httptest.Server,
	isTTY bool,
	output string,
)

Source from the content-addressed store, hash-verified

51}
52
53func newOpts(
54 t *testing.T,
55 srv *httptest.Server,
56 isTTY bool,
57 output string,
58) (*UpdateOptions, *test.CmdInOut) {
59 t.Helper()
60 seedToken(t)
61 t.Setenv("ALGOLIA_APPLICATION_ID", "APP1")
62
63 f, out := test.NewFactory(isTTY, nil, nil, "")
64 pf := cmdutil.NewPrintFlags()
65 *pf.OutputFormat = output
66 pf.OutputFlagSpecified = func() bool { return output != "" }
67
68 opts := &UpdateOptions{
69 IO: f.IOStreams,
70 Config: f.Config,
71 PrintFlags: pf,
72 Name: "Renamed App",
73 NewDashboardClient: func(string) *dashboard.Client {
74 c := dashboard.NewClientWithHTTPClient("test", srv.Client())
75 c.APIURL = srv.URL
76 return c
77 },
78 }
79 return opts, out
80}
81
82func Test_runUpdateCmd(t *testing.T) {
83 srv := newServer(t)

Callers 2

Test_runUpdateCmdFunction · 0.70

Calls 5

NewFactoryFunction · 0.92
NewPrintFlagsFunction · 0.92
NewClientWithHTTPClientFunction · 0.92
HelperMethod · 0.80
seedTokenFunction · 0.70

Tested by

no test coverage detected