client_mock

package
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERR_Unexpected_Url     = "call %q expected url %q, got %q"
	ERR_Unexpected_Data    = "call %q expected data %v, got %v"
	ERR_Unexpected_Headers = "call %q expected headers %v, got %v"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MockedClient

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

func New added in v1.1.0

func New() *MockedClient

Create new Client instance

func (*MockedClient) AllExpectationsDone

func (m *MockedClient) AllExpectationsDone() error

Check if all expected calls were done

func (*MockedClient) ExpectGet

func (m *MockedClient) ExpectGet(url string, err error, response *http.Response, headers map[string]string)

Store expected call of Get method with expected data and error

func (*MockedClient) ExpectPost

func (m *MockedClient) ExpectPost(url string, body []byte, err error, response *http.Response, headers map[string]string)

Store expected call of Post method with expected data and error

func (*MockedClient) Get

func (m *MockedClient) Get(ctx context.Context, url string, headers map[string]string) (*http.Response, error)

Check if call of Get method was expected and returning expected response and error

func (*MockedClient) Post

func (m *MockedClient) Post(ctx context.Context, url string, body []byte, headers map[string]string) (*http.Response, error)

Check if call of Post method was expected and returning expected response and error

func (*MockedClient) Reset

func (m *MockedClient) Reset()

Reset all expected calls

Jump to

Keyboard shortcuts

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