Documentation ¶
Index ¶
- Constants
- func GatewayURL() *url.URL
- func NewProxyClient(proxyURL string) *http.Client
- func NewProxyTunnelClient(proxyURL string) *http.Client
- func RunWithSpecs(t *testing.T, tests SugarTests, required ...specs.Leaf)
- func SubdomainGatewayURL() *url.URL
- type AllOfExpectBuilder
- type AnyOfExpectBuilder
- type ExpectBuilder
- func (e ExpectBuilder) Body(body interface{}) ExpectBuilder
- func (e ExpectBuilder) BodyWithHint(hint string, body interface{}) ExpectBuilder
- func (e ExpectBuilder) Bytes(body string) ExpectBuilder
- func (e ExpectBuilder) Clone() ExpectValidator
- func (e ExpectBuilder) Header(h HeaderBuilder) ExpectBuilder
- func (e ExpectBuilder) Headers(hs ...HeaderBuilder) ExpectBuilder
- func (e ExpectBuilder) Spec(spec string) ExpectBuilder
- func (e ExpectBuilder) Specs(specs ...string) ExpectBuilder
- func (e ExpectBuilder) Status(statusCode int) ExpectBuilder
- func (e ExpectBuilder) StatusBetween(from, to int) ExpectBuilder
- func (e ExpectBuilder) Validate(t *testing.T, res *http.Response, localReport Reporter)
- type ExpectValidator
- type ExpectsBuilder
- type HeaderBuilder
- func (h HeaderBuilder) Checks(f func(string) bool) HeaderBuilder
- func (h HeaderBuilder) ChecksAll(f func([]string) bool) HeaderBuilder
- func (h HeaderBuilder) Clone() HeaderBuilder
- func (h HeaderBuilder) Contains(value string, rest ...any) HeaderBuilder
- func (h HeaderBuilder) Equals(value string, args ...any) HeaderBuilder
- func (h HeaderBuilder) Exists() HeaderBuilder
- func (h HeaderBuilder) Has(values ...string) HeaderBuilder
- func (h HeaderBuilder) Hint(hint string) HeaderBuilder
- func (h HeaderBuilder) IsEmpty() HeaderBuilder
- func (h HeaderBuilder) Matches(value string, rest ...any) HeaderBuilder
- func (h HeaderBuilder) Not() HeaderBuilder
- func (h HeaderBuilder) Spec(spec string) HeaderBuilder
- func (h HeaderBuilder) Specs(specs ...string) HeaderBuilder
- type ReportInput
- type Reporter
- type RequestBuilder
- func (r RequestBuilder) Clone() RequestBuilder
- func (r RequestBuilder) FollowRedirects() RequestBuilder
- func (r RequestBuilder) Header(k, v string, rest ...any) RequestBuilder
- func (r RequestBuilder) Headers(hs ...HeaderBuilder) RequestBuilder
- func (r RequestBuilder) Method(method string) RequestBuilder
- func (r RequestBuilder) Path(path string, args ...any) RequestBuilder
- func (r RequestBuilder) Proxy(path string, args ...any) RequestBuilder
- func (r RequestBuilder) Query(key, value string, args ...any) RequestBuilder
- func (r RequestBuilder) RemoveHeader(hdr string) string
- func (r RequestBuilder) WithProxyTunnel() RequestBuilder
- type SugarTest
- type SugarTests
Constants ¶
const TEMPLATE = `` /* 217-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func GatewayURL ¶
func NewProxyClient ¶
NewProxyClient creates an HTTP client that routes requests through an HTTP proxy.
func NewProxyTunnelClient ¶
NewProxyTunnelClient creates an HTTP client that routes requests through an HTTP proxy using the CONNECT method, as described in RFC 7231 Section 4.3.6.
func RunWithSpecs ¶
func RunWithSpecs( t *testing.T, tests SugarTests, required ...specs.Leaf, )
func SubdomainGatewayURL ¶
Types ¶
type AllOfExpectBuilder ¶
type AllOfExpectBuilder struct {
Expect_ []ExpectValidator `json:"expect,omitempty"`
}
func AllOf ¶
func AllOf(expect ...ExpectValidator) AllOfExpectBuilder
func (AllOfExpectBuilder) Clone ¶
func (e AllOfExpectBuilder) Clone() ExpectValidator
Clone performs a deep clone of the AllOfExpectBuilder Note: if there are [check.Check]s used in the header or body components of the nested builders those are only shallowly cloned
type AnyOfExpectBuilder ¶
type AnyOfExpectBuilder struct {
Expect_ []ExpectBuilder `json:"expect,omitempty"`
}
func AnyOf ¶
func AnyOf(expect ...ExpectBuilder) AnyOfExpectBuilder
func (AnyOfExpectBuilder) Clone ¶
func (e AnyOfExpectBuilder) Clone() ExpectValidator
Clone performs a deep clone of the AnyOfExpectBuilder Note: if there are [check.Check]s used in the header or body components of the nested builders those are only shallowly cloned
type ExpectBuilder ¶
type ExpectBuilder struct { StatusCode_ int `json:"statusCode,omitempty"` StatusCodeFrom_ int `json:"statusCodeFrom,omitempty"` StatusCodeTo_ int `json:"statusCodeTo,omitempty"` Headers_ []HeaderBuilder `json:"headers,omitempty"` Body_ interface{} `json:"body,omitempty"` Specs_ []string `json:"specs,omitempty"` }
func Expect ¶
func Expect() ExpectBuilder
func ResponsesAreEqual ¶
func ResponsesAreEqual() ExpectBuilder
func (ExpectBuilder) Body ¶
func (e ExpectBuilder) Body(body interface{}) ExpectBuilder
func (ExpectBuilder) BodyWithHint ¶
func (e ExpectBuilder) BodyWithHint(hint string, body interface{}) ExpectBuilder
func (ExpectBuilder) Bytes ¶
func (e ExpectBuilder) Bytes(body string) ExpectBuilder
func (ExpectBuilder) Clone ¶
func (e ExpectBuilder) Clone() ExpectValidator
Clone performs a deep clone of the ExpectBuilder Note: if there are [check.Check]s used in the inner header or body components those are only shallowly cloned
func (ExpectBuilder) Header ¶
func (e ExpectBuilder) Header(h HeaderBuilder) ExpectBuilder
func (ExpectBuilder) Headers ¶
func (e ExpectBuilder) Headers(hs ...HeaderBuilder) ExpectBuilder
func (ExpectBuilder) Spec ¶
func (e ExpectBuilder) Spec(spec string) ExpectBuilder
func (ExpectBuilder) Specs ¶
func (e ExpectBuilder) Specs(specs ...string) ExpectBuilder
func (ExpectBuilder) Status ¶
func (e ExpectBuilder) Status(statusCode int) ExpectBuilder
func (ExpectBuilder) StatusBetween ¶
func (e ExpectBuilder) StatusBetween(from, to int) ExpectBuilder
type ExpectValidator ¶
type ExpectsBuilder ¶
type ExpectsBuilder struct {
// contains filtered or unexported fields
}
func Responses ¶
func Responses() ExpectsBuilder
func (ExpectsBuilder) HaveTheSamePayload ¶
func (e ExpectsBuilder) HaveTheSamePayload() ExpectsBuilder
type HeaderBuilder ¶
type HeaderBuilder struct { Key_ string `json:"key,omitempty"` Value_ string `json:"value,omitempty"` Check_ check.Check[[]string] `json:"check,omitempty"` Hint_ string `json:"hint,omitempty"` Specs_ []string `json:"specs,omitempty"` Not_ bool `json:"not,omitempty"` }
func Header ¶
func Header(key string, rest ...any) HeaderBuilder
func (HeaderBuilder) Checks ¶
func (h HeaderBuilder) Checks(f func(string) bool) HeaderBuilder
func (HeaderBuilder) ChecksAll ¶
func (h HeaderBuilder) ChecksAll(f func([]string) bool) HeaderBuilder
func (HeaderBuilder) Clone ¶
func (h HeaderBuilder) Clone() HeaderBuilder
Clone performs a shallow clone of the HeaderBuilder Note: The Check field is an interface and as a result is just copied
func (HeaderBuilder) Contains ¶
func (h HeaderBuilder) Contains(value string, rest ...any) HeaderBuilder
func (HeaderBuilder) Equals ¶
func (h HeaderBuilder) Equals(value string, args ...any) HeaderBuilder
func (HeaderBuilder) Exists ¶
func (h HeaderBuilder) Exists() HeaderBuilder
func (HeaderBuilder) Has ¶
func (h HeaderBuilder) Has(values ...string) HeaderBuilder
func (HeaderBuilder) Hint ¶
func (h HeaderBuilder) Hint(hint string) HeaderBuilder
func (HeaderBuilder) IsEmpty ¶
func (h HeaderBuilder) IsEmpty() HeaderBuilder
func (HeaderBuilder) Matches ¶
func (h HeaderBuilder) Matches(value string, rest ...any) HeaderBuilder
func (HeaderBuilder) Not ¶
func (h HeaderBuilder) Not() HeaderBuilder
func (HeaderBuilder) Spec ¶
func (h HeaderBuilder) Spec(spec string) HeaderBuilder
func (HeaderBuilder) Specs ¶
func (h HeaderBuilder) Specs(specs ...string) HeaderBuilder
type ReportInput ¶
type RequestBuilder ¶
type RequestBuilder struct { Method_ string `json:"method,omitempty"` Path_ string `json:"path,omitempty"` Proxy_ string `json:"proxy,omitempty"` UseProxyTunnel_ bool `json:"useProxyTunnel,omitempty"` Headers_ map[string]string `json:"headers,omitempty"` FollowRedirects_ bool `json:"followRedirects,omitempty"` Query_ url.Values `json:"query,omitempty"` Body_ []byte `json:"body,omitempty"` }
func Request ¶
func Request() RequestBuilder
func Requests ¶
func Requests(rs ...RequestBuilder) []RequestBuilder
func (RequestBuilder) Clone ¶
func (r RequestBuilder) Clone() RequestBuilder
func (RequestBuilder) FollowRedirects ¶
func (r RequestBuilder) FollowRedirects() RequestBuilder
func (RequestBuilder) Header ¶
func (r RequestBuilder) Header(k, v string, rest ...any) RequestBuilder
func (RequestBuilder) Headers ¶
func (r RequestBuilder) Headers(hs ...HeaderBuilder) RequestBuilder
func (RequestBuilder) Method ¶
func (r RequestBuilder) Method(method string) RequestBuilder
func (RequestBuilder) Path ¶
func (r RequestBuilder) Path(path string, args ...any) RequestBuilder
func (RequestBuilder) Proxy ¶
func (r RequestBuilder) Proxy(path string, args ...any) RequestBuilder
func (RequestBuilder) Query ¶
func (r RequestBuilder) Query(key, value string, args ...any) RequestBuilder
func (RequestBuilder) RemoveHeader ¶ added in v0.6.0
func (r RequestBuilder) RemoveHeader(hdr string) string
func (RequestBuilder) WithProxyTunnel ¶
func (r RequestBuilder) WithProxyTunnel() RequestBuilder
type SugarTest ¶
type SugarTest struct { Name string Hint string Spec string Specs []string Request RequestBuilder Requests []RequestBuilder Response ExpectValidator Responses ExpectsBuilder }
type SugarTests ¶
type SugarTests []SugarTest
func (SugarTests) Append ¶
func (s SugarTests) Append(tests ...SugarTest) SugarTests