rclone: github.com/ncw/rclone/fstest/mockobject Index | Files

package mockobject

import "github.com/ncw/rclone/fstest/mockobject"

Package mockobject provides a mock object which can be created from a string

Index

Package Files

mockobject.go

Variables

var SeekModes = []SeekMode{SeekModeNone, SeekModeRegular, SeekModeRange}

SeekModes contains all valid SeekMode's

type ContentMockObject Uses

type ContentMockObject struct {
    Object
    // contains filtered or unexported fields
}

ContentMockObject mocks an fs.Object and has content

func (*ContentMockObject) Fs Uses

func (o *ContentMockObject) Fs() fs.Info

Fs returns read only access to the Fs that this object is part of

This is nil unless SetFs has been called

func (*ContentMockObject) Open Uses

func (o *ContentMockObject) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error)

Open opens the file for read. Call Close() on the returned io.ReadCloser

func (*ContentMockObject) SetFs Uses

func (o *ContentMockObject) SetFs(f fs.Fs)

SetFs sets the return value of the Fs() call

func (*ContentMockObject) Size Uses

func (o *ContentMockObject) Size() int64

Size returns the size of the file

type Object Uses

type Object string

Object is a mock fs.Object useful for testing

func New Uses

func New(name string) Object

New returns mock fs.Object useful for testing

func (Object) Fs Uses

func (o Object) Fs() fs.Info

Fs returns read only access to the Fs that this object is part of

func (Object) Hash Uses

func (o Object) Hash(ctx context.Context, t hash.Type) (string, error)

Hash returns the selected checksum of the file If no checksum is available it returns ""

func (Object) ModTime Uses

func (o Object) ModTime(ctx context.Context) (t time.Time)

ModTime returns the modification date of the file It should return a best guess if one isn't available

func (Object) Open Uses

func (o Object) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error)

Open opens the file for read. Call Close() on the returned io.ReadCloser

func (Object) Remote Uses

func (o Object) Remote() string

Remote returns the remote path

func (Object) Remove Uses

func (o Object) Remove(ctx context.Context) error

Remove this object

func (Object) SetModTime Uses

func (o Object) SetModTime(ctx context.Context, t time.Time) error

SetModTime sets the metadata on the object to set the modification date

func (Object) Size Uses

func (o Object) Size() int64

Size returns the size of the file

func (Object) Storable Uses

func (o Object) Storable() bool

Storable says whether this object can be stored

func (Object) String Uses

func (o Object) String() string

String returns a description of the Object

func (Object) Update Uses

func (o Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error

Update in to the object with the modTime given of the given size

func (Object) WithContent Uses

func (o Object) WithContent(content []byte, mode SeekMode) *ContentMockObject

WithContent returns a fs.Object with the given content.

type SeekMode Uses

type SeekMode int

SeekMode specifies the optional Seek interface for the ReadCloser returned by Open

const (
    // SeekModeNone specifies no seek interface
    SeekModeNone SeekMode = iota
    // SeekModeRegular specifies the regular io.Seek interface
    SeekModeRegular
    // SeekModeRange specifies the fs.RangeSeek interface
    SeekModeRange
)

func (SeekMode) String Uses

func (m SeekMode) String() string

Package mockobject imports 8 packages (graph). Updated 2019-08-17. Refresh now. Tools for package owners.