Documentation
¶
Overview ¶
Package scenario holds the godog test harness: a per-scenario context that boots the auth0-mock service in-process on a random port and provides HTTP helpers for the .feature step files.
Index ¶
- func RegisterSteps(sc *godog.ScenarioContext, c *Context)
- type Context
- func (c *Context) Do(method, path string, body string, withBearer bool)
- func (c *Context) DoForm(method, path string, form url.Values, withBearer bool)
- func (c *Context) DoFormWithAuthorization(method, path string, form url.Values, authorization string)
- func (c *Context) KeepCookies()
- func (c *Context) MintBearer()
- func (c *Context) VerifyAccessTokenAgainstJWKS(tok string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterSteps ¶
func RegisterSteps(sc *godog.ScenarioContext, c *Context)
RegisterSteps wires the .feature step phrases to Go functions.
Types ¶
type Context ¶
type Context struct {
BaseURL string
BearerTok string
MFAToken string // captured from a 403 mfa_required response.
RefreshTok string // captured from a token response.
LastResp *http.Response
LastBody []byte
// SSEResp holds the response from a successful SSE subscription
// so subsequent steps (push, deliver) can read frames from its
// body without conflicting with assertions against LastResp.
SSEResp *http.Response
// contains filtered or unexported fields
}
Context is the per-scenario state passed to step definitions.
func New ¶
func New(t *testing.T, sc *godog.ScenarioContext) *Context
New constructs a fresh Context, boots the service in-process on a random localhost port, and registers cleanup hooks via godog.
func (*Context) DoFormWithAuthorization ¶ added in v0.233.0
func (c *Context) DoFormWithAuthorization(method, path string, form url.Values, authorization string)
DoFormWithAuthorization is DoForm with an explicit Authorization header value; empty sends none.
func (*Context) KeepCookies ¶ added in v0.233.0
func (c *Context) KeepCookies()
KeepCookies makes this scenario's later requests share one cookie jar.
func (*Context) MintBearer ¶
func (c *Context) MintBearer()
MintBearer issues a token via the live /oauth/token endpoint.
func (*Context) VerifyAccessTokenAgainstJWKS ¶
VerifyAccessTokenAgainstJWKS fetches the mock's JWKS and verifies the token's RS256 signature using golang-jwt + MicahParks/keyfunc.