(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestContainerExportOutputToFile(t *testing.T) { |
| 14 | dir := fs.NewDir(t, "export-test") |
| 15 | defer dir.Remove() |
| 16 | |
| 17 | cli := test.NewFakeCli(&fakeClient{ |
| 18 | containerExportFunc: func(container string) (client.ContainerExportResult, error) { |
| 19 | // FIXME(thaJeztah): how to mock this? |
| 20 | return mockContainerExportResult("bar"), nil |
| 21 | }, |
| 22 | }) |
| 23 | cmd := newExportCommand(cli) |
| 24 | cmd.SetOut(io.Discard) |
| 25 | cmd.SetArgs([]string{"-o", dir.Join("foo"), "container"}) |
| 26 | assert.NilError(t, cmd.Execute()) |
| 27 | |
| 28 | expected := fs.Expected(t, |
| 29 | fs.WithFile("foo", "bar", fs.MatchAnyFileMode), |
| 30 | ) |
| 31 | |
| 32 | assert.Assert(t, fs.Equal(dir.Path(), expected)) |
| 33 | } |
| 34 | |
| 35 | func TestContainerExportOutputToIrregularFile(t *testing.T) { |
| 36 | cli := test.NewFakeCli(&fakeClient{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…