diff --git a/cmd/oras/internal/display/status/tty_console_test.go b/cmd/oras/internal/display/status/tty_console_test.go index 9deb9a234..588be0d32 100644 --- a/cmd/oras/internal/display/status/tty_console_test.go +++ b/cmd/oras/internal/display/status/tty_console_test.go @@ -128,7 +128,7 @@ func TestTTYCopyHandler_OnCopySkipped(t *testing.T) { } ch.StopTracking() - if err = testutils.MatchPty(pty, slave, "Exists", mockFetcher.OciImage.MediaType, strconv.FormatInt(mockFetcher.OciImage.Size, 10), "100%"); err != nil { + if err = testutils.MatchPty(pty, slave, "Exists", "oci-image", strconv.FormatInt(mockFetcher.OciImage.Size, 10), "100%"); err != nil { t.Fatal(err) } } diff --git a/cmd/oras/root/cp_test.go b/cmd/oras/root/cp_test.go index c6c88b6d6..1e9b19ea1 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) @@ -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)