mocks

package
v1.40.18 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: MIT Imports: 10 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
	AuthErr    bool
}

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 MockMapsClient added in v1.36.17

type MockMapsClient struct {
	TimezoneResult *maps.TimezoneResult
	GeocodeResult  []maps.GeocodingResult

	TimezoneErr bool
	GeocodeErr  bool
}

MockMapsClient is a mock implementation of MapsClientInterface.

func (*MockMapsClient) Geocode added in v1.36.17

Geocode calls the mocked Geocode function.

func (*MockMapsClient) Timezone added in v1.36.17

Timezone calls the mocked Timezone function.

type MockReadFileFS

type MockReadFileFS struct {
	FileContents map[string][]byte

	ReadFileErr bool
}

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 {
	ReadResult int

	ReadErr  bool
	CloseErr 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
}

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.

type MockTokenSource added in v1.36.17

type MockTokenSource struct {
	T        *oauth2.Token
	TokenErr bool
}

MockTokenSource is a mock implementation of oauth2.TokenSource.

func (*MockTokenSource) Token added in v1.36.17

func (m *MockTokenSource) Token() (*oauth2.Token, error)

Token returns the mock token or error based on the configuration.

Jump to

Keyboard shortcuts

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