(t *testing.T)
| 153 | } |
| 154 | |
| 155 | func TestConfigInspectPretty(t *testing.T) { |
| 156 | testCases := []struct { |
| 157 | name string |
| 158 | configInspectFunc func(context.Context, string, client.ConfigInspectOptions) (client.ConfigInspectResult, error) |
| 159 | }{ |
| 160 | { |
| 161 | name: "simple", |
| 162 | configInspectFunc: func(_ context.Context, id string, _ client.ConfigInspectOptions) (client.ConfigInspectResult, error) { |
| 163 | return client.ConfigInspectResult{ |
| 164 | Config: *builders.Config( |
| 165 | builders.ConfigLabels(map[string]string{ |
| 166 | "lbl1": "value1", |
| 167 | }), |
| 168 | builders.ConfigID("configID"), |
| 169 | builders.ConfigName("configName"), |
| 170 | builders.ConfigCreatedAt(time.Time{}), |
| 171 | builders.ConfigUpdatedAt(time.Time{}), |
| 172 | builders.ConfigData([]byte("payload here")), |
| 173 | ), |
| 174 | }, nil |
| 175 | }, |
| 176 | }, |
| 177 | } |
| 178 | for _, tc := range testCases { |
| 179 | cli := test.NewFakeCli(&fakeClient{ |
| 180 | configInspectFunc: tc.configInspectFunc, |
| 181 | }) |
| 182 | cmd := newConfigInspectCommand(cli) |
| 183 | |
| 184 | cmd.SetArgs([]string{"configID"}) |
| 185 | assert.Check(t, cmd.Flags().Set("pretty", "true")) |
| 186 | assert.NilError(t, cmd.Execute()) |
| 187 | golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("config-inspect-pretty.%s.golden", tc.name)) |
| 188 | } |
| 189 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…