mock

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	URL() string // URl retrieves the URL to connect to.
	Start()      // Start attempts to start the server
	Close()      // Close attempts to close the server

	Expect(path string, method string) Expectation // Expect adds a new expectation to the stack.
	AllExpectationsMet() error                     // AllExpectationsMet reports whether all expectations have been met or used.
}

API represents a mock API.

func NewMockAPI

func NewMockAPI(enc format.Encoder) API

NewMockAPI initialises a new mock api using the supplied encoder for the body.

type Expectation

type Expectation interface {
	WithStatusCode(code int)               // WithStatusCode sets the status code for an expectation.
	WithResult(code int, body interface{}) // WithResult sets the status code and result body for an expectation.
}

Expectation represents a met expectation. Effectively the result of matching a path and HTTP method.

Jump to

Keyboard shortcuts

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