testsupport

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 13 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
	Auth         string
	Authorizer   *oauth2support.ResourceJwtAuthorizer
	Scopes       []string
}

func NewMockHTTPClient

func NewMockHTTPClient() *MockHTTPClient

func NewMockHttpClientWithJwt added in v0.6.13

func NewMockHttpClientWithJwt(jwksUrl string, issuer string, aud string, scopes []string) (*MockHTTPClient, error)

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