storj.io/uplink@v1.13.0/private/metaclient/types_test.go (about)

     1  // Copyright (C) 2020 Storj Labs, Inc.
     2  // See LICENSE for copying information.
     3  
     4  package metaclient_test
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/stretchr/testify/require"
    10  
    11  	"storj.io/uplink/private/metaclient"
    12  )
    13  
    14  func TestListOptions(t *testing.T) {
    15  	opts := metaclient.ListOptions{
    16  		Prefix:                "alpha/",
    17  		Cursor:                "a",
    18  		Delimiter:             '/',
    19  		Recursive:             true,
    20  		Direction:             metaclient.After,
    21  		Limit:                 30,
    22  		IncludeCustomMetadata: true,
    23  		IncludeSystemMetadata: true,
    24  		Status:                2,
    25  	}
    26  
    27  	list := metaclient.ObjectList{
    28  		Bucket: "hello",
    29  		Prefix: "alpha/",
    30  		More:   true,
    31  		Cursor: []byte("encrypted_path"),
    32  		Items: []metaclient.Object{
    33  			{Path: "alpha/xyz"},
    34  		},
    35  	}
    36  
    37  	newopts := opts.NextPage(list)
    38  	require.Equal(t, metaclient.ListOptions{
    39  		Prefix:                "alpha/",
    40  		Cursor:                "",
    41  		CursorEnc:             []byte("encrypted_path"),
    42  		Delimiter:             '/',
    43  		Recursive:             true,
    44  		Direction:             metaclient.After,
    45  		Limit:                 30,
    46  		IncludeCustomMetadata: true,
    47  		IncludeSystemMetadata: true,
    48  		Status:                2,
    49  	}, newopts)
    50  }