mocks

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const YamlTwoImages = `` /* 3293-byte string literal not displayed */

YamlTwoImages - a yaml example with two image references

Variables

This section is empty.

Functions

This section is empty.

Types

type IoMock

type IoMock struct {
	// ListYamlFilesPathsFunc mocks the ListYamlFilesPaths method.
	ListYamlFilesPathsFunc func(rootPath string) ([]string, error)

	// ReadFileFunc mocks the ReadFile method.
	ReadFileFunc func(filename string) ([]byte, error)

	// WriteFileFunc mocks the WriteFile method.
	WriteFileFunc func(filename string, data []byte, perm os.FileMode) error
	// contains filtered or unexported fields
}

IoMock is a mock implementation of Io.

    func TestSomethingThatUsesIo(t *testing.T) {

        // make and configure a mocked Io
        mockedIo := &IoMock{
            ListYamlFilesPathsFunc: func(rootPath string) ([]string, error) {
	               panic("mock out the ListYamlFilesPaths method")
            },
            ReadFileFunc: func(filename string) ([]byte, error) {
	               panic("mock out the ReadFile method")
            },
            WriteFileFunc: func(filename string, data []byte, perm os.FileMode) error {
	               panic("mock out the WriteFile method")
            },
        }

        // use mockedIo in code that requires Io
        // and then make assertions.

    }

func (*IoMock) ListYamlFilesPaths

func (mock *IoMock) ListYamlFilesPaths(rootPath string) ([]string, error)

ListYamlFilesPaths calls ListYamlFilesPathsFunc.

func (*IoMock) ListYamlFilesPathsCalls

func (mock *IoMock) ListYamlFilesPathsCalls() []struct {
	RootPath string
}

ListYamlFilesPathsCalls gets all the calls that were made to ListYamlFilesPaths. Check the length with:

len(mockedIo.ListYamlFilesPathsCalls())

func (*IoMock) ReadFile

func (mock *IoMock) ReadFile(filename string) ([]byte, error)

ReadFile calls ReadFileFunc.

func (*IoMock) ReadFileCalls

func (mock *IoMock) ReadFileCalls() []struct {
	Filename string
}

ReadFileCalls gets all the calls that were made to ReadFile. Check the length with:

len(mockedIo.ReadFileCalls())

func (*IoMock) WriteFile

func (mock *IoMock) WriteFile(filename string, data []byte, perm os.FileMode) error

WriteFile calls WriteFileFunc.

func (*IoMock) WriteFileCalls

func (mock *IoMock) WriteFileCalls() []struct {
	Filename string
	Data     []byte
	Perm     os.FileMode
}

WriteFileCalls gets all the calls that were made to WriteFile. Check the length with:

len(mockedIo.WriteFileCalls())

Jump to

Keyboard shortcuts

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