assert

package
v0.0.0-...-82e7740 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPBody

func HTTPBody(handle xhttp.Handle, method, url string, values url.Values) string

HTTPBody is a helper that returns HTTP body of the response. It returns empty string if building a new request fails.

func HTTPBodyContains

func HTTPBodyContains(t *testing.T, handle xhttp.Handle, method, url string, values url.Values, str interface{}) bool

HTTPBodyContains asserts that a specified handle returns a body that contains a string.

assert.HTTPBodyContains(t, handle, "/a/b/c", nil, "ok")

Returns whether the assertion was successful (true) or not (false).

func HTTPBodyNotContains

func HTTPBodyNotContains(t *testing.T, handle xhttp.Handle, method, url string, values url.Values, str interface{}) bool

HTTPBodyNotContains asserts that a specified handle returns a body that does not contain a string.

assert.HTTPBodyNotContains(t, handle, "/a/b/c", nil, "no")

Returns whether the assertion was successful (true) or not (false).

func HTTPError

func HTTPError(t *testing.T, handle xhttp.Handle, method, url string, values url.Values) bool

HTTPError asserts that a specified handle returns an error status code.

assert.HTTPError(t, handle, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}

Returns whether the assertion was successful (true) or not (false).

func HTTPRedirect

func HTTPRedirect(t *testing.T, handle xhttp.Handle, method, url string, values url.Values) bool

HTTPRedirect asserts that a specified handle returns a redirect status code.

assert.HTTPRedirect(t, handle, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}

Returns whether the assertion was successful (true) or not (false).

func HTTPSuccess

func HTTPSuccess(t *testing.T, handle xhttp.Handle, method, url string, values url.Values) bool

HTTPSuccess asserts that a specified handle returns a success status code.

assert.HTTPSuccess(t, handle, "POST", "/a/b/c", nil)

Returns whether the assertion was successful (true) or not (false).

Types

This section is empty.

Jump to

Keyboard shortcuts

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