Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Expectation ¶
type Expectation struct { Headers ExpectedHeaders `json:"headers"` QueryParams ExpectedQueryParams `json:"queryParams"` }
Expectation contains expectations for the endpoint
func NewExpectation ¶
func NewExpectation() Expectation
NewExpectation returns a setup Expectation used for test cases.
type Expectations ¶
type Expectations []Expectation
func (Expectations) AtLeastOneExpectationPasses ¶
func (e Expectations) AtLeastOneExpectationPasses(r *http.Request) bool
AtLeastOneExpectationPasses verifies that for multiple expectations at least one passes successfully, allowing the simulation to proceed
func (*Expectations) UnmarshalJSON ¶
func (e *Expectations) UnmarshalJSON(d []byte) error
UnmarshalJSON allows expectations to be declared either as an array or as a singular expectation
type ExpectedHeaders ¶
type ExpectedHeaders struct {
textproto.MIMEHeader
}
ExpectedHeaders does what it says on the tin
func (*ExpectedHeaders) UnmarshalJSON ¶
func (e *ExpectedHeaders) UnmarshalJSON(d []byte) error
UnmarshalJSON supports non-array declaration of headers
type ExpectedQueryParams ¶
ExpectedQueryParams does what it says on the tin
func (*ExpectedQueryParams) UnmarshalJSON ¶
func (e *ExpectedQueryParams) UnmarshalJSON(d []byte) error
UnmarshalJSON supports non-array declaration of headers
type Resource ¶
type Resource struct { Status int `json:"status"` Headers map[string]string `json:"headers"` Body interface{} `json:"body"` Expectations Expectations `json:"expectations"` }
Resource mocks a particular http method for a given path
type Router ¶
type Router interface { Get(path string, handler http.HandlerFunc, middleware ...vestigo.Middleware) Put(path string, handler http.HandlerFunc, middleware ...vestigo.Middleware) Post(path string, handler http.HandlerFunc, middleware ...vestigo.Middleware) Delete(path string, handler http.HandlerFunc, middleware ...vestigo.Middleware) }
Router allows us to test that paths are configured properly