testing

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertErrorContains

func AssertErrorContains(t *testing.T, theError error, msg string)

AssertRequestEqual asserts that the expectations match the actual error

func AssertLogText

func AssertLogText(t *testing.T, expectedText, actualText string)

func AssertRequestEqual

func AssertRequestEqual(t *testing.T, re *RequestExpectation, actualRequest *http.Request)

AssertRequestEqual asserts that the expectations match the actual request

func AssertSyncMapEqual

func AssertSyncMapEqual(t *testing.T, expected, actual *sync.Map, msgAndArgs ...interface{}) bool

func CaptureOutput

func CaptureOutput(f func()) string

Types

type KeyValueStr

type KeyValueStr struct {
	Key   string
	Value string
}

type RequestExpectation

type RequestExpectation struct {
	IsNilRequestExpected bool
	ExpectedURL          StringExpectation
	ExpectedMethod       StringExpectation
	ExpectedHeaders      []KeyValueStr
	ExpectedBody         StringExpectation
}

RequestExpectation contains expectation info for a http request

type StringExpectation

type StringExpectation struct {
	Value    string
	IsActive bool
}

StringExpectation defines string assertion rule, if IsActive is false expectation is disabled

func NewStringExpectation

func NewStringExpectation(value string) StringExpectation

NewStringExpectation creates active expectation

Jump to

Keyboard shortcuts

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