testing

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: MPL-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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