restest

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const HeaderContentType = "Content-Type"

Variables

This section is empty.

Functions

This section is empty.

Types

type TestManager

type TestManager struct {
	// contains filtered or unexported fields
}

TestManager is helper to test REST handler created with echo HTTP server

func For

func For(t *testing.T) *TestManager

For builds a test manager using the provided test context T

func (*TestManager) Given

func (m *TestManager) Given() *given

Given returns the GIVEN builder. It allows to define the preconditions for the test

func (*TestManager) Json

func (m *TestManager) Json(jsonStr string) interface{}

Json allows to define the request or response body from JSON in a string.

func (*TestManager) JsonFile

func (m *TestManager) JsonFile(fileName string) interface{}

JsonFile allows to define the request or response body from JSON in a string.

func (*TestManager) Then

func (m *TestManager) Then() *then

Then returns the THEN builder. It allows to verify the expectations (post conditions) for the test

func (*TestManager) When

func (m *TestManager) When() *when

When returns the WHEN builder. It allows to execute the handler under test

func (*TestManager) WithDefaultErrorHandler

func (m *TestManager) WithDefaultErrorHandler() *TestManager

func (*TestManager) WithErrorHandler

func (m *TestManager) WithErrorHandler(errorHandler echo.HTTPErrorHandler) *TestManager

WithErrorHandler adds to the TestManager an error handler to convert errors to HTTP codes

func (*TestManager) WithServer

func (m *TestManager) WithServer(server *echo.Echo) *TestManager

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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