(t *testing.T)
| 14 | ) |
| 15 | |
| 16 | func TestNewPullCommandErrors(t *testing.T) { |
| 17 | testCases := []struct { |
| 18 | name string |
| 19 | args []string |
| 20 | expectedError string |
| 21 | }{ |
| 22 | { |
| 23 | name: "wrong-args", |
| 24 | expectedError: "requires 1 argument", |
| 25 | args: []string{}, |
| 26 | }, |
| 27 | { |
| 28 | name: "invalid-name", |
| 29 | expectedError: "invalid reference format: repository name (library/UPPERCASE_REPO) must be lowercase", |
| 30 | args: []string{"UPPERCASE_REPO"}, |
| 31 | }, |
| 32 | { |
| 33 | name: "all-tags-with-tag", |
| 34 | expectedError: "tag can't be used with --all-tags/-a", |
| 35 | args: []string{"--all-tags", "image:tag"}, |
| 36 | }, |
| 37 | } |
| 38 | for _, tc := range testCases { |
| 39 | t.Run(tc.name, func(t *testing.T) { |
| 40 | cli := test.NewFakeCli(&fakeClient{}) |
| 41 | cmd := newPullCommand(cli) |
| 42 | cmd.SetOut(io.Discard) |
| 43 | cmd.SetErr(io.Discard) |
| 44 | cmd.SetArgs(tc.args) |
| 45 | assert.ErrorContains(t, cmd.Execute(), tc.expectedError) |
| 46 | }) |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | func TestNewPullCommandSuccess(t *testing.T) { |
| 51 | testCases := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…