mocks

package
v0.0.0-...-9855ac9 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitMockTerm

func InitMockTerm(mt *MockTerm)

Types

type Expector

type Expector struct {
	Failed bool
	Exp    []string
}

type MockClient

type MockClient struct {
	Contents   string // file contents to send back
	Url        string // Url to validate
	Err        error  // Error to return on call
	StatusCode int    // Status code to return
}

mocks the parts of http.Client that I use

func (*MockClient) Get

func (mc *MockClient) Get(url string) (*http.Response, error)

type MockFI

type MockFI struct {
	Fname string
	Files []string
	Ftext string  // the mocked file contents
	Mom   *MockFS // *may* point to the FileSystem mock that holds this file
}

func (MockFI) IsDir

func (mi MockFI) IsDir() bool

func (MockFI) ModTime

func (mi MockFI) ModTime() time.Time

func (MockFI) Mode

func (mi MockFI) Mode() os.FileMode

func (MockFI) Name

func (mi MockFI) Name() string

func (MockFI) Size

func (mi MockFI) Size() int64

func (MockFI) Sys

func (mi MockFI) Sys() interface{}

type MockFS

type MockFS struct {
	File       string // Filename
	Content    string // text in the file
	StatErr    bool   // return an error when stat is called
	ReadErr    *bool  // return error from read call
	OpenAlways bool   // return a file handle no matter what
	Events     map[string]bool

	// desired Readdir results
	Names []string
	Err   int
}

func (MockFS) Close

func (mf MockFS) Close() error

func (MockFS) Open

func (mf MockFS) Open(file string) (http.File, error)

func (MockFS) Read

func (mf MockFS) Read(p []byte) (int, error)

func (MockFS) Readdir

func (mf MockFS) Readdir(n int) ([]os.FileInfo, error)

func (*MockFS) SawName

func (mf *MockFS) SawName()

func (MockFS) Seek

func (mf MockFS) Seek(offset int64, whence int) (int64, error)

func (MockFS) Stat

func (mf MockFS) Stat() (os.FileInfo, error)

type MockFile

type MockFile struct {
	FileName string
	AccMode  gwtypes.AccessMode
	LckMode  gwtypes.LockMode
}

func MockAnOpenFile

func MockAnOpenFile(name string) MockFile

func (*MockFile) AccessMode

func (maf *MockFile) AccessMode() gwtypes.AccessMode

func (*MockFile) FQFN

func (maf *MockFile) FQFN() string

func (*MockFile) LockMode

func (maf *MockFile) LockMode() gwtypes.LockMode

type MockRdr

type MockRdr struct {
	// contains filtered or unexported fields
}

func NewReader

func NewReader(b []byte) *MockRdr

func (*MockRdr) Read

func (rdr *MockRdr) Read(p []byte) (n int, err error)

type MockServ

type MockServ struct {
	ExpURL   string
	Requests []string
	// contains filtered or unexported fields
}

func NewMockServer

func NewMockServer(statuscode int, body []byte) *MockServ

NewMockServer returns a pointer to a ready to use mock http server caller should call close when finished, to shut it down

func (*MockServ) Close

func (ms *MockServ) Close()

Close the mock server

type MockTerm

type MockTerm struct {
	Row      *int
	Col      *int
	StrVal   *string
	SawStr   *string
	SawCls   *bool
	SawBeep  *bool
	SawBreak *bool
	ExpMsg   *Expector
}

func (MockTerm) BreakCheck

func (mt MockTerm) BreakCheck() bool

func (MockTerm) Cls

func (mt MockTerm) Cls()

func (MockTerm) GetCursor

func (mt MockTerm) GetCursor() (int, int)

func (MockTerm) Locate

func (mt MockTerm) Locate(int, int)

func (MockTerm) Log

func (mt MockTerm) Log(msg string)

func (MockTerm) Print

func (mt MockTerm) Print(msg string)

func (MockTerm) Println

func (mt MockTerm) Println(msg string)

func (MockTerm) Read

func (mt MockTerm) Read(col, row, length int) string

func (MockTerm) ReadKeys

func (mt MockTerm) ReadKeys(count int) []byte

func (MockTerm) SoundBell

func (mt MockTerm) SoundBell()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL