(t *testing.T)
| 59 | } |
| 60 | |
| 61 | func TestConfigCreateWithName(t *testing.T) { |
| 62 | const name = "config-with-name" |
| 63 | var actual []byte |
| 64 | cli := test.NewFakeCli(&fakeClient{ |
| 65 | configCreateFunc: func(_ context.Context, options client.ConfigCreateOptions) (client.ConfigCreateResult, error) { |
| 66 | if options.Spec.Name != name { |
| 67 | return client.ConfigCreateResult{}, fmt.Errorf("expected name %q, got %q", name, options.Spec.Name) |
| 68 | } |
| 69 | |
| 70 | actual = options.Spec.Data |
| 71 | |
| 72 | return client.ConfigCreateResult{ |
| 73 | ID: "ID-" + options.Spec.Name, |
| 74 | }, nil |
| 75 | }, |
| 76 | }) |
| 77 | |
| 78 | cmd := newConfigCreateCommand(cli) |
| 79 | cmd.SetArgs([]string{name, filepath.Join("testdata", configDataFile)}) |
| 80 | assert.NilError(t, cmd.Execute()) |
| 81 | golden.Assert(t, string(actual), configDataFile) |
| 82 | assert.Check(t, is.Equal("ID-"+name, strings.TrimSpace(cli.OutBuffer().String()))) |
| 83 | } |
| 84 | |
| 85 | func TestConfigCreateWithLabels(t *testing.T) { |
| 86 | expectedLabels := map[string]string{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…