mocks

package
v1.36.7 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockFirebaseApp

type MockFirebaseApp struct {
	AuthClient *auth.Client
	Err        error
}

MockFirebaseApp is a mock implementation of FirebaseAppInterface.

func (*MockFirebaseApp) Auth

func (m *MockFirebaseApp) Auth(ctx context.Context) (*auth.Client, error)

Auth mocks the Auth method of FirebaseAppInterface.

type MockReadFileFS

type MockReadFileFS struct {
	FileContents map[string][]byte // Maps file paths to their contents
	Err          error             // Error to simulate on read
}

MockReadFileFS is a mock implementation of fs.ReadFileFS.

func (*MockReadFileFS) Open

func (m *MockReadFileFS) Open(string) (fs.File, error)

func (*MockReadFileFS) ReadFile

func (m *MockReadFileFS) ReadFile(name string) ([]byte, error)

ReadFile simulates reading a file from the mock filesystem.

type MockReader

type MockReader struct {
	ReadShouldFail  bool
	CloseShouldFail bool
}

func NewMockReader

func NewMockReader() *MockReader

func (*MockReader) Close

func (r *MockReader) Close() error

func (*MockReader) Read

func (r *MockReader) Read([]byte) (int, error)

type MockResponseWriter

type MockResponseWriter struct {
	HeaderMap  http.Header
	StatusCode int
	Body       bytes.Buffer

	WriteErr bool // Force Write() calls to error.
}

MockResponseWriter is a custom mock implementation of http.ResponseWriter.

func NewMockResponseWriter

func NewMockResponseWriter() *MockResponseWriter

NewMockResponseWriter creates a new instance of MockResponseWriter.

func (*MockResponseWriter) Header

func (rw *MockResponseWriter) Header() http.Header

Header returns the mock headers.

func (*MockResponseWriter) Write

func (rw *MockResponseWriter) Write(p []byte) (int, error)

Write mocks the Write method, which writes the response body.

func (*MockResponseWriter) WriteHeader

func (rw *MockResponseWriter) WriteHeader(statusCode int)

WriteHeader mocks the WriteHeader method, which sets the HTTP status code.

Jump to

Keyboard shortcuts

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