Documentation ¶
Overview ¶
nolint
nolint
nolint
Index ¶
- func AddAndLoginIdentities(t *testing.T, reg *driver.RegistryDefault, public *httptest.Server, ...) map[string]*http.Client
- func CleanSQL(t *testing.T, c *pop.Connection)
- func CourierExpectLinkInMessage(t *testing.T, message *courier.Message, offset int) string
- func CourierExpectMessage(t *testing.T, reg interface{ ... }, recipient, subject string) *courier.Message
- func EncodeFormAsJSON(t *testing.T, isApi bool, values url.Values) (payload string)
- func ExistingNetwork(t *testing.T, p persistence.Persister, id uuid.UUID) persistence.Persister
- func ExpectStatusCode(isAPI bool, api, browser int) int
- func ExpectURL(isAPI bool, api, browser string) string
- func GetRecoveryFlow(t *testing.T, client *http.Client, ts *httptest.Server) *kratos.RecoveryFlow
- func GetVerificationFlow(t *testing.T, client *http.Client, ts *httptest.Server) *kratos.VerificationFlow
- func HTTPPostForm(t *testing.T, client *http.Client, remote string, in *url.Values) ([]byte, *http.Response)
- func HTTPRequestJSON(t *testing.T, client *http.Client, method string, url string, in interface{}) ([]byte, *http.Response)
- func InitKratosServers(t *testing.T, reg driver.Registry, public, admin *httptest.Server)
- func InitializeLoginFlowViaAPI(t *testing.T, client *http.Client, ts *httptest.Server, forced bool) *kratos.LoginFlow
- func InitializeLoginFlowViaBrowser(t *testing.T, client *http.Client, ts *httptest.Server, forced bool) *kratos.LoginFlow
- func InitializeRecoveryFlowViaAPI(t *testing.T, client *http.Client, ts *httptest.Server) *kratos.RecoveryFlow
- func InitializeRecoveryFlowViaBrowser(t *testing.T, client *http.Client, ts *httptest.Server) *kratos.RecoveryFlow
- func InitializeRegistrationFlowViaAPI(t *testing.T, client *http.Client, ts *httptest.Server) *kratos.RegistrationFlow
- func InitializeRegistrationFlowViaBrowser(t *testing.T, client *http.Client, ts *httptest.Server) *kratos.RegistrationFlow
- func InitializeSettingsFlowViaAPI(t *testing.T, client *http.Client, ts *httptest.Server) *kratos.SettingsFlow
- func InitializeSettingsFlowViaBrowser(t *testing.T, client *http.Client, ts *httptest.Server) *kratos.SettingsFlow
- func InitializeVerificationFlowViaAPI(t *testing.T, client *http.Client, ts *httptest.Server) *kratos.VerificationFlow
- func InitializeVerificationFlowViaBrowser(t *testing.T, client *http.Client, ts *httptest.Server) *kratos.VerificationFlow
- func JSONEq(t *testing.T, expected, actual interface{}, messageAndArgs ...interface{})
- func LogJSON(t *testing.T, v interface{})
- func LoginMakeRequest(t *testing.T, isAPI bool, f *kratos.LoginFlow, hc *http.Client, values string) (string, *http.Response)
- func MockGetSession(t *testing.T, reg mockDeps) httprouter.Handle
- func MockHydrateCookieClient(t *testing.T, c *http.Client, u string)
- func MockMakeAuthenticatedRequest(t *testing.T, reg mockDeps, conf *config.Config, router *httprouter.Router, ...) ([]byte, *http.Response)
- func MockSessionCreateHandler(t *testing.T, reg mockDeps) (httprouter.Handle, *session.Session)
- func MockSessionCreateHandlerWithIdentity(t *testing.T, reg mockDeps, i *identity.Identity) (httprouter.Handle, *session.Session)
- func MockSetSession(t *testing.T, reg mockDeps, conf *config.Config) httprouter.Handle
- func NewClientWithCookies(t *testing.T) *http.Client
- func NewDebugClient(t *testing.T) *http.Client
- func NewErrorTestServer(t *testing.T, reg interface{ ... }) *httptest.Server
- func NewFakeCSRFNode() *kratos.UiNode
- func NewHTTPClientWithArbitrarySessionCookie(t *testing.T, reg *driver.RegistryDefault) *http.Client
- func NewHTTPClientWithArbitrarySessionToken(t *testing.T, reg *driver.RegistryDefault) *http.Client
- func NewHTTPClientWithIdentitySessionCookie(t *testing.T, reg *driver.RegistryDefault, id *identity.Identity) *http.Client
- func NewHTTPClientWithIdentitySessionToken(t *testing.T, reg *driver.RegistryDefault, id *identity.Identity) *http.Client
- func NewHTTPClientWithSessionCookie(t *testing.T, reg *driver.RegistryDefault, sess *session.Session) *http.Client
- func NewHTTPClientWithSessionToken(t *testing.T, reg *driver.RegistryDefault, sess *session.Session) *http.Client
- func NewHTTPDeleteJSONRequest(t *testing.T, url string, in interface{}) *http.Request
- func NewHTTPGetJSONRequest(t *testing.T, url string) *http.Request
- func NewHTTPTestServer(t *testing.T, h http.Handler) *httptest.Server
- func NewKratosServer(t *testing.T, reg driver.Registry) (public, admin *httptest.Server)
- func NewKratosServerWithCSRF(t *testing.T, reg driver.Registry) (public, admin *httptest.Server)
- func NewKratosServerWithRouters(t *testing.T, reg driver.Registry, rp *x.RouterPublic, ra *x.RouterAdmin) (public, admin *httptest.Server)
- func NewKratosServers(t *testing.T) (public, admin *httptest.Server)
- func NewLoginUIFlowEchoServer(t *testing.T, reg driver.Registry) *httptest.Server
- func NewLoginUIWith401Response(t *testing.T, c *config.Config) *httptest.Server
- func NewMethodSubmit(group, value string) *kratos.UiNode
- func NewNetwork(t *testing.T, ctx context.Context, p persistence.Persister) (uuid.UUID, persistence.Persister)
- func NewNetworkUnlessExisting(t *testing.T, ctx context.Context, p persistence.Persister) (uuid.UUID, persistence.Persister)
- func NewPasswordNode() *kratos.UiNode
- func NewRecoveryUIFlowEchoServer(t *testing.T, reg driver.Registry) *httptest.Server
- func NewRedirSessionEchoTS(t *testing.T, reg interface{ ... }) *httptest.Server
- func NewRedirTS(t *testing.T, body string, conf *config.Config) *httptest.Server
- func NewRegistrationUIFlowEchoServer(t *testing.T, reg driver.Registry) *httptest.Server
- func NewRequest(t *testing.T, isAPI bool, method string, url string, payload io.Reader) *http.Request
- func NewSDKClient(ts *httptest.Server) *kratos.APIClient
- func NewSDKClientFromURL(u string) *kratos.APIClient
- func NewSDKCustomClient(ts *httptest.Server, client *http.Client) *kratos.APIClient
- func NewSDKEmailNode(group string) *kratos.UiNode
- func NewSDKOIDCNode(name, provider string) *kratos.UiNode
- func NewSessionClient(t *testing.T, u string) *http.Client
- func NewSettingsAPIServer(t *testing.T, reg *driver.RegistryDefault, ids map[string]*identity.Identity) (*httptest.Server, *httptest.Server, map[string]*http.Client)
- func NewSettingsLoginAcceptAPIServer(t *testing.T, adminClient *kratos.APIClient, conf *config.Config) *httptest.Server
- func NewSettingsUIEchoServer(t *testing.T, reg *driver.RegistryDefault) *httptest.Server
- func NewSettingsUIFlowEchoServer(t *testing.T, reg driver.Registry) *httptest.Server
- func NewSettingsUITestServer(t *testing.T, conf *config.Config) *httptest.Server
- func NewVerificationUIFlowEchoServer(t *testing.T, reg driver.Registry) *httptest.Server
- func RecoveryMakeRequest(t *testing.T, isAPI bool, f *kratos.RecoveryFlow, hc *http.Client, ...) (string, *http.Response)
- func RegistrationMakeRequest(t *testing.T, isAPI bool, f *kratos.RegistrationFlow, hc *http.Client, ...) (string, *http.Response)
- func SDKFormFieldsToURLValues(ff []kratos.UiNode) url.Values
- func SelfServiceHookConfigReset(t *testing.T, conf *config.Config) func()
- func SelfServiceHookCreateFakeIdentity(t *testing.T, reg driver.Registry) *identity.Identity
- func SelfServiceHookErrorHandler(t *testing.T, w http.ResponseWriter, r *http.Request, abortErr error, ...) bool
- func SelfServiceHookFakeIdentity(t *testing.T) *identity.Identity
- func SelfServiceHookLoginErrorHandler(t *testing.T, w http.ResponseWriter, r *http.Request, err error) bool
- func SelfServiceHookLoginSetDefaultRedirectTo(t *testing.T, conf *config.Config, value string)
- func SelfServiceHookLoginSetDefaultRedirectToStrategy(t *testing.T, conf *config.Config, strategy, value string)
- func SelfServiceHookLoginViperSetPost(t *testing.T, conf *config.Config, strategy string, c []config.SelfServiceHook)
- func SelfServiceHookRegistrationErrorHandler(t *testing.T, w http.ResponseWriter, r *http.Request, err error) bool
- func SelfServiceHookRegistrationSetDefaultRedirectTo(t *testing.T, conf *config.Config, value string)
- func SelfServiceHookRegistrationSetDefaultRedirectToStrategy(t *testing.T, conf *config.Config, strategy, value string)
- func SelfServiceHookRegistrationViperSetPost(t *testing.T, conf *config.Config, strategy string, c []config.SelfServiceHook)
- func SelfServiceHookSettingsErrorHandler(t *testing.T, w http.ResponseWriter, r *http.Request, err error) bool
- func SelfServiceHookSettingsSetDefaultRedirectTo(t *testing.T, conf *config.Config, value string)
- func SelfServiceHookSettingsSetDefaultRedirectToStrategy(t *testing.T, conf *config.Config, strategy, value string)
- func SelfServiceMakeHookRequest(t *testing.T, ts *httptest.Server, suffix string, asAPI bool, query url.Values) (*http.Response, string)
- func SelfServiceMakeLoginPostHookRequest(t *testing.T, ts *httptest.Server, asAPI bool, query url.Values) (*http.Response, string)
- func SelfServiceMakeLoginPreHookRequest(t *testing.T, ts *httptest.Server) (*http.Response, string)
- func SelfServiceMakeRegistrationPostHookRequest(t *testing.T, ts *httptest.Server, asAPI bool, query url.Values) (*http.Response, string)
- func SelfServiceMakeRegistrationPreHookRequest(t *testing.T, ts *httptest.Server) (*http.Response, string)
- func SelfServiceMakeSettingsPostHookRequest(t *testing.T, ts *httptest.Server, asAPI bool, query url.Values) (*http.Response, string)
- func SetDefaultIdentitySchema(t *testing.T, conf *config.Config, location string)
- func SetIdentitySchemas(t *testing.T, conf *config.Config, schemas map[string]string)
- func SettingsMakeRequest(t *testing.T, isAPI bool, f *kratos.SettingsFlow, hc *http.Client, ...) (string, *http.Response)
- func SkipIfNetworkContext(t *testing.T, ctx context.Context)
- func StrategyEnable(t *testing.T, c *config.Config, strategy string, enable bool)
- func SubmitLoginForm(t *testing.T, isAPI bool, hc *http.Client, publicTS *httptest.Server, ...) string
- func SubmitRecoveryForm(t *testing.T, isAPI bool, hc *http.Client, publicTS *httptest.Server, ...) string
- func SubmitRegistrationForm(t *testing.T, isAPI bool, hc *http.Client, publicTS *httptest.Server, ...) string
- func SubmitSettingsForm(t *testing.T, isAPI bool, hc *http.Client, publicTS *httptest.Server, ...) string
- func SubmitVerificationForm(t *testing.T, isAPI bool, hc *http.Client, publicTS *httptest.Server, ...) string
- func TestSelfServicePreHook(configKey string, ...) func(t *testing.T)
- func UseConfigFile(t *testing.T, path string) *pflag.FlagSet
- func VerificationMakeRequest(t *testing.T, isAPI bool, f *kratos.VerificationFlow, hc *http.Client, ...) (string, *http.Response)
- type SessionLifespanProvider
- type TransportWithLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAndLoginIdentities ¶
func AddAndLoginIdentities(t *testing.T, reg *driver.RegistryDefault, public *httptest.Server, ids map[string]*identity.Identity) map[string]*http.Client
AddAndLoginIdentities adds the given identities to the store (like a registration flow) and returns http.Clients which contain their sessions.
func CourierExpectMessage ¶
func EncodeFormAsJSON ¶
func ExistingNetwork ¶
func ExistingNetwork(t *testing.T, p persistence.Persister, id uuid.UUID) persistence.Persister
func ExpectStatusCode ¶
func GetRecoveryFlow ¶
func GetVerificationFlow ¶
func HTTPPostForm ¶
func HTTPRequestJSON ¶
func InitKratosServers ¶
func LoginMakeRequest ¶
func MockGetSession ¶
func MockGetSession(t *testing.T, reg mockDeps) httprouter.Handle
func MockSetSession ¶
func NewErrorTestServer ¶
func NewFakeCSRFNode ¶
func NewFakeCSRFNode() *kratos.UiNode
func NewKratosServer ¶
func NewKratosServerWithCSRF ¶
func NewKratosServerWithRouters ¶
func NewKratosServerWithRouters(t *testing.T, reg driver.Registry, rp *x.RouterPublic, ra *x.RouterAdmin) (public, admin *httptest.Server)
func NewMethodSubmit ¶
func NewMethodSubmit(group, value string) *kratos.UiNode
func NewNetwork ¶
func NewNetwork(t *testing.T, ctx context.Context, p persistence.Persister) (uuid.UUID, persistence.Persister)
func NewNetworkUnlessExisting ¶
func NewNetworkUnlessExisting(t *testing.T, ctx context.Context, p persistence.Persister) (uuid.UUID, persistence.Persister)
func NewPasswordNode ¶
func NewPasswordNode() *kratos.UiNode
func NewRedirSessionEchoTS ¶
func NewRedirSessionEchoTS(t *testing.T, reg interface { x.WriterProvider session.ManagementProvider config.Provider }) *httptest.Server
func NewRequest ¶
func NewSDKClient ¶
func NewSDKClientFromURL ¶
func NewSDKClientFromURL(u string) *kratos.APIClient
func NewSDKCustomClient ¶
func NewSDKEmailNode ¶
func NewSDKEmailNode(group string) *kratos.UiNode
func NewSDKOIDCNode ¶
func NewSDKOIDCNode(name, provider string) *kratos.UiNode
func NewSettingsAPIServer ¶
func NewSettingsUIEchoServer ¶
func NewSettingsUITestServer ¶
func RecoveryMakeRequest ¶
func RegistrationMakeRequest ¶
func SetDefaultIdentitySchema ¶
SetDefaultIdentitySchema sets the identity schemas in viper config:
testhelpers.SetDefaultIdentitySchema("file://customer.json")
func SetIdentitySchemas ¶
SetIdentitySchemas sets the identity schemas in viper config:
testhelpers.SetIdentitySchemas(map[string]string{"customer": "file://customer.json"})
func SettingsMakeRequest ¶
func StrategyEnable ¶
func SubmitLoginForm ¶
func SubmitLoginForm( t *testing.T, isAPI bool, hc *http.Client, publicTS *httptest.Server, withValues func(v url.Values), method identity.CredentialsType, forced bool, expectedStatusCode int, expectedURL string, ) string
SubmitLoginForm initiates a login flow (for Browser and API!), fills out the form and modifies the form values with `withValues`, and submits the form. Returns the body and checks for expectedStatusCode and expectedURL on completion
func SubmitRecoveryForm ¶
func SubmitRecoveryForm( t *testing.T, isAPI bool, hc *http.Client, publicTS *httptest.Server, withValues func(v url.Values), expectedStatusCode int, expectedURL string, ) string
SubmitRecoveryForm initiates a registration flow (for Browser and API!), fills out the form and modifies the form values with `withValues`, and submits the form. If completed, it will return the flow as JSON.
func SubmitRegistrationForm ¶
func SubmitRegistrationForm( t *testing.T, isAPI bool, hc *http.Client, publicTS *httptest.Server, withValues func(v url.Values), method identity.CredentialsType, expectedStatusCode int, expectedURL string, ) string
SubmitRegistrationForm (for Browser and API!), fills out the form and modifies // the form values with `withValues`, and submits the form. Returns the body and checks for expectedStatusCode and // expectedURL on completion
func SubmitSettingsForm ¶
func SubmitSettingsForm( t *testing.T, isAPI bool, hc *http.Client, publicTS *httptest.Server, withValues func(v url.Values), expectedStatusCode int, expectedURL string, ) string
SubmitSettingsForm initiates a settings flow (for Browser and API!), fills out the form and modifies the form values with `withValues`, and submits the form. If completed, it will return the flow as JSON.
func SubmitVerificationForm ¶
func SubmitVerificationForm( t *testing.T, isAPI bool, hc *http.Client, publicTS *httptest.Server, withValues func(v url.Values), expectedStatusCode int, expectedURL string, ) string
SubmitVerificationForm initiates a registration flow (for Browser and API!), fills out the form and modifies the form values with `withValues`, and submits the form. If completed, it will return the flow as JSON.
func TestSelfServicePreHook ¶
Types ¶
type SessionLifespanProvider ¶
type SessionLifespanProvider struct {
// contains filtered or unexported fields
}
func NewSessionLifespanProvider ¶
func NewSessionLifespanProvider(expiresIn time.Duration) *SessionLifespanProvider
func (*SessionLifespanProvider) SessionLifespan ¶
func (p *SessionLifespanProvider) SessionLifespan() time.Duration
type TransportWithLogger ¶
type TransportWithLogger struct { http.RoundTripper // contains filtered or unexported fields }
func NewTransportWithLogger ¶
func NewTransportWithLogger(parent http.RoundTripper, t *testing.T) *TransportWithLogger