Documentation
¶
Index ¶
- Constants
- func StartApplicationHTTPListener(root context.Context, errc chan error, settings Settings)
- type AssuredEndpoints
- func (a *AssuredEndpoints) ClearAllEndpoint(ctx context.Context, i interface{}) (interface{}, error)
- func (a *AssuredEndpoints) ClearEndpoint(ctx context.Context, call *Call) (interface{}, error)
- func (a *AssuredEndpoints) GivenCallbackEndpoint(ctx context.Context, call *Call) (interface{}, error)
- func (a *AssuredEndpoints) GivenEndpoint(ctx context.Context, call *Call) (interface{}, error)
- func (a *AssuredEndpoints) VerifyEndpoint(ctx context.Context, call *Call) (interface{}, error)
- func (a *AssuredEndpoints) WhenEndpoint(ctx context.Context, call *Call) (interface{}, error)
- func (a *AssuredEndpoints) WrappedEndpoint(handler func(context.Context, *Call) (interface{}, error)) endpoint.Endpoint
- type Call
- type CallResponse
- type CallStore
- type Callback
- type Client
- type Settings
Constants ¶
const ( AssuredStatus = "Assured-Status" AssuredDelay = "Assured-Delay" AssuredCallbackKey = "Assured-Callback-Key" AssuredCallbackTarget = "Assured-Callback-Target" AssuredCallbackDelay = "Assured-Callback-Delay" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AssuredEndpoints ¶
type AssuredEndpoints struct {
// contains filtered or unexported fields
}
AssuredEndpoints
func NewAssuredEndpoints ¶
func NewAssuredEndpoints(settings Settings) *AssuredEndpoints
NewAssuredEndpoints creates a new instance of assured endpoints
func (*AssuredEndpoints) ClearAllEndpoint ¶
func (a *AssuredEndpoints) ClearAllEndpoint(ctx context.Context, i interface{}) (interface{}, error)
ClearAllEndpoint is used to clear all assured calls
func (*AssuredEndpoints) ClearEndpoint ¶
func (a *AssuredEndpoints) ClearEndpoint(ctx context.Context, call *Call) (interface{}, error)
ClearEndpoint is used to clear a specific assured call
func (*AssuredEndpoints) GivenCallbackEndpoint ¶
func (a *AssuredEndpoints) GivenCallbackEndpoint(ctx context.Context, call *Call) (interface{}, error)
GivenCallbackEndpoint is used to stub out callbacks for a callback key
func (*AssuredEndpoints) GivenEndpoint ¶
func (a *AssuredEndpoints) GivenEndpoint(ctx context.Context, call *Call) (interface{}, error)
GivenEndpoint is used to stub out a call for a given path
func (*AssuredEndpoints) VerifyEndpoint ¶
func (a *AssuredEndpoints) VerifyEndpoint(ctx context.Context, call *Call) (interface{}, error)
VerifyEndpoint is used to verify a particular call
func (*AssuredEndpoints) WhenEndpoint ¶
func (a *AssuredEndpoints) WhenEndpoint(ctx context.Context, call *Call) (interface{}, error)
WhenEndpoint is used to test the assured calls
func (*AssuredEndpoints) WrappedEndpoint ¶
func (a *AssuredEndpoints) WrappedEndpoint(handler func(context.Context, *Call) (interface{}, error)) endpoint.Endpoint
WrappedEndpoint is used to validate that the incoming request is an assured call
type Call ¶
type Call struct { Path string `json:"path"` Method string `json:"method"` StatusCode int `json:"status_code"` Delay int `json:"delay"` Headers map[string]string `json:"headers"` Query map[string]string `json:"query,omitempty"` Response CallResponse `json:"response,omitempty"` Callbacks []Callback `json:"callbacks,omitempty"` }
Call is a structure containing a request that is stubbed or made
type CallResponse ¶
type CallResponse []byte
CallResponse allows control over the Call's Response encoding
func (*CallResponse) UnmarshalJSON ¶
func (response *CallResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON is a custom implementation for JSON Unmarshalling for the CallResponse Unmarshalling will first check if the data is a local filepath that can be read Else it will check if the data is stringified JSON and un-stringify the data to use or Else it will just use the []byte
type CallStore ¶
func NewCallStore ¶
func NewCallStore() *CallStore
type Callback ¶
type Callback struct { Target string `json:"target"` Method string `json:"method"` Delay int `json:"delay,omitempty"` Headers map[string]string `json:"headers"` Response CallResponse `json:"response,omitempty"` }
Callback is a structure containing a callback that is stubbed
type Client ¶
Client
func NewDefaultClient ¶
func NewDefaultClient() *Client
NewDefaultClient creates a new go-rest-assured client with default parameters