diff --git a/cmd/oras/root/cp_test.go b/cmd/oras/root/cp_test.go index c6c88b6d6..1746c0e61 100644 --- a/cmd/oras/root/cp_test.go +++ b/cmd/oras/root/cp_test.go @@ -25,7 +25,6 @@ import ( "net/http/httptest" "net/url" "os" - "strings" "testing" "github.com/opencontainers/go-digest" @@ -33,7 +32,6 @@ import ( "oras.land/oras-go/v2/content/memory" "oras.land/oras-go/v2/registry/remote" "oras.land/oras/cmd/oras/internal/display/status" - "oras.land/oras/cmd/oras/internal/output" "oras.land/oras/internal/testutils" ) @@ -131,9 +129,7 @@ func Test_doCopy(t *testing.T) { opts.TTY = slave opts.From.Reference = memDesc.Digest.String() dst := memory.New() - builder := &strings.Builder{} - printer := output.NewPrinter(builder, os.Stderr) - handler := status.NewTextCopyHandler(printer, dst) + handler := status.NewTTYCopyHandler(opts.TTY) // test _, err = doCopy(context.Background(), handler, memStore, dst, &opts) if err != nil { @@ -155,9 +151,7 @@ func Test_doCopy_skipped(t *testing.T) { var opts copyOptions opts.TTY = slave opts.From.Reference = memDesc.Digest.String() - builder := &strings.Builder{} - printer := output.NewPrinter(builder, os.Stderr) - handler := status.NewTextCopyHandler(printer, memStore) + handler := status.NewTTYCopyHandler(opts.TTY) // test _, err = doCopy(context.Background(), handler, memStore, memStore, &opts) @@ -165,7 +159,7 @@ func Test_doCopy_skipped(t *testing.T) { t.Fatal(err) } // validate - if err = testutils.MatchPty(pty, slave, "Exists", memDesc.MediaType, "100.00%", memDesc.Digest.String()); err != nil { + if err = testutils.MatchPty(pty, slave, "Exists", "oci-image", "100.00%", memDesc.Digest.String()); err != nil { t.Fatal(err) } } @@ -191,10 +185,7 @@ func Test_doCopy_mounted(t *testing.T) { t.Fatal(err) } to.PlainHTTP = true - builder := &strings.Builder{} - printer := output.NewPrinter(builder, os.Stderr) - printer.Verbose = true - handler := status.NewTextCopyHandler(printer, to) + handler := status.NewTTYCopyHandler(opts.TTY) // test _, err = doCopy(context.Background(), handler, from, to, &opts)