testsupport

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsExactly

func ContainsExactly[T any](t *testing.T, arrayToCheck []T, elementsToCheck ...T)

func WithSetUp

func WithSetUp[T TestData](data T, test func(data T))

Types

type MockHTTPClient

type MockHTTPClient struct {
	mock.Mock
	Err          error
	ResponseBody map[string][]byte
	RequestBody  map[string][]byte
	Url          string
	StatusCode   int
	StatusCodes  map[string]int
	Called       map[string]int
}

func NewMockHTTPClient

func NewMockHTTPClient() *MockHTTPClient

func (*MockHTTPClient) AddCognitoRequest

func (m *MockHTTPClient) AddCognitoRequest(method, url, apiOp string, statusCode int, responseBody []byte)

func (*MockHTTPClient) AddRequest

func (m *MockHTTPClient) AddRequest(method, url string, statusCode int, responseBody []byte)

func (*MockHTTPClient) CalledWithStatus

func (m *MockHTTPClient) CalledWithStatus(method, url string, expStatusCode int) bool

func (*MockHTTPClient) Do

func (m *MockHTTPClient) Do(req *http.Request) (*http.Response, error)

func (*MockHTTPClient) Get

func (m *MockHTTPClient) Get(url string) (resp *http.Response, err error)

func (*MockHTTPClient) GetCognitoRequestBody

func (m *MockHTTPClient) GetCognitoRequestBody(method, url, serviceOp string) []byte

func (*MockHTTPClient) GetRequestBody

func (m *MockHTTPClient) GetRequestBody(url string) []byte

func (*MockHTTPClient) GetRequestBodyByKey

func (m *MockHTTPClient) GetRequestBodyByKey(method, url string) []byte

func (*MockHTTPClient) Post

func (m *MockHTTPClient) Post(url, _ string, body io.Reader) (resp *http.Response, err error)

func (*MockHTTPClient) VerifyCalled

func (m *MockHTTPClient) VerifyCalled() bool

type TestData

type TestData interface {
	SetUp()
	TearDown()
}

Directories

Path Synopsis
Package tools provides utilities for tests.
Package tools provides utilities for tests.

Jump to

Keyboard shortcuts

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