( t *testing.T, srv *httptest.Server, isTTY bool, output string, )
| 51 | } |
| 52 | |
| 53 | func 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 | |
| 82 | func Test_runUpdateCmd(t *testing.T) { |
| 83 | srv := newServer(t) |
no test coverage detected