testhelper

package
Version: v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBrokenFS = fmt.Errorf("mocked")

ErrBrokenFS is a default error that will be returned if some operation is mocked

Functions

This section is empty.

Types

type BrokenFS

type BrokenFS struct {
	billy.Filesystem
	// contains filtered or unexported fields
}

BrokenFS is a simple billy.Filesystem mockup

func NewBrokenFS

func NewBrokenFS(fs billy.Filesystem, opts BrokenFSOptions) *BrokenFS

NewBrokenFS is BrokenFS constructor

func (*BrokenFS) Chroot

func (fs *BrokenFS) Chroot(path string) (billy.Filesystem, error)

func (*BrokenFS) Create

func (fs *BrokenFS) Create(filename string) (billy.File, error)

func (*BrokenFS) Open

func (fs *BrokenFS) Open(filename string) (billy.File, error)

func (*BrokenFS) OpenFile

func (fs *BrokenFS) OpenFile(filename string, flag int, perm os.FileMode) (billy.File, error)

func (*BrokenFS) Stat

func (fs *BrokenFS) Stat(filename string) (os.FileInfo, error)

func (*BrokenFS) TempFile

func (fs *BrokenFS) TempFile(dir, prefix string) (billy.File, error)

type BrokenFSOptions

type BrokenFSOptions struct {
	FailedOpen     bool
	FailedOpenFile bool
	FailedStat     bool
	FailedChroot   bool
	FailedCreate   bool
	FailedTempFile bool
}

BrokenFSOptions contains list of operations that will be broken in the scope of this mock up

type Helper

type Helper struct {
	Dir    string
	Siva   string
	FS     billy.Filesystem
	TempFS billy.Filesystem
	Lib    *siva.Library
}

Helper is a struct that's used to simplify preparation and execution of download tests

func NewHelper

func NewHelper() (*Helper, func(), error)

NewHelper is Helper's constructor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL