tests_e2e

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContentTypeJsonHeaders map[string]string = map[string]string{
	"Content-type": "application/json",
}

Functions

func AssertMapHasValues added in v0.2.0

func AssertMapHasValues[T_Key comparable, T_Value comparable](
	t *testing.T,
	subject map[T_Key]T_Value,
	values map[T_Key]T_Value,
)

func AssertTimeDifferenceEqualOrMoreThanSeconds added in v0.3.0

func AssertTimeDifferenceEqualOrMoreThanSeconds(t *testing.T, timeA, timeB time.Time, seconds int)

func AssertTimeDifferenceLessThanSeconds added in v0.3.0

func AssertTimeDifferenceLessThanSeconds(t *testing.T, timeA, timeB time.Time, seconds int)

func GetKeys added in v0.2.0

func GetKeys[T_Key comparable, T_Value interface{}](subject map[T_Key]T_Value) []T_Key

func HeadersMatch added in v0.2.0

func HeadersMatch(expectedHeaders map[string]string) func(t *testing.T, response *Response)

func IndexOf added in v0.2.0

func IndexOf[T comparable](list []T, value T) int

func JsonMatches added in v0.1.0

func JsonMatches(expectedJson map[string]interface{}) func(t *testing.T, response *Response)

func LineEquals added in v0.2.0

func LineEquals(lineNumber int, expectedLine string) func(t *testing.T, response *Response)

func LineRegexMatches added in v0.2.0

func LineRegexMatches(lineNumber int, regex string) func(t *testing.T, response *Response)

func MockAssert

func MockAssert(assertConfig *mocklib.AssertConfig, serverOutput *bytes.Buffer) []mocklib.ValidationError

func RequestApiReset added in v0.1.1

func RequestApiReset(config *mocklib.MockConfig)

func RunMock

func RunMock(state *E2eState, command string) ([]byte, error)

func RunTest added in v0.1.0

func RunTest(
	t *testing.T,
	configurationFilePath,
	method,
	route string,
	headers map[string]string,
	body string,
	assertionFunc ...func(t *testing.T, response *Response),
)

func StatusCodeMatches added in v0.2.0

func StatusCodeMatches(expectedStatusCode int) func(t *testing.T, response *Response)

func StringMatches added in v0.1.0

func StringMatches(expected string) func(t *testing.T, response *Response)

Types

type E2eState

type E2eState struct {
	BinaryPath string
}

func NewState

func NewState() *E2eState

type KillMockFunc

type KillMockFunc func()

func RunMockBg

func RunMockBg(state *E2eState, command string) (KillMockFunc, *bytes.Buffer, *mocklib.MockConfig)

type Response added in v0.2.0

type Response struct {
	Body       []byte
	Headers    map[string]string
	StatusCode int
}

func Request

func Request(config *mocklib.MockConfig, method, route, payload string, headers map[string]string) *Response

Jump to

Keyboard shortcuts

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