MCPcopy
hub / github.com/ory/kratos / NewFastRegistryWithMocks

Function NewFastRegistryWithMocks

pkg/driver.go:63–74  ·  view source on GitHub ↗

NewFastRegistryWithMocks returns a registry with several mocks and an SQLite in memory database that make testing easier and way faster. This suite does not work for e2e or advanced integration tests.

(t *testing.T, opts ...configx.OptionModifier)

Source from the content-addressed store, hash-verified

61// NewFastRegistryWithMocks returns a registry with several mocks and an SQLite in memory database that make testing
62// easier and way faster. This suite does not work for e2e or advanced integration tests.
63func NewFastRegistryWithMocks(t *testing.T, opts ...configx.OptionModifier) (*config.Config, *driver.RegistryDefault) {
64 conf, reg := NewRegistryDefaultWithDSN(t, "", opts...)
65 reg.WithCSRFTokenGenerator(nosurfx.FakeCSRFTokenGenerator)
66 reg.WithCSRFHandler(nosurfx.NewFakeCSRFHandler(reg))
67 reg.WithHooks(map[string]func(config.SelfServiceHook) interface{}{
68 "err": func(c config.SelfServiceHook) interface{} {
69 return &hook.Error{Config: c.Config}
70 },
71 })
72
73 return conf, reg
74}
75
76// NewRegistryDefaultWithDSN returns a more standard registry without mocks. Good for e2e and advanced integration testing!
77func NewRegistryDefaultWithDSN(t testing.TB, dsn string, opts ...configx.OptionModifier) (*config.Config, *driver.RegistryDefault) {

Callers 15

TestCipherFunction · 0.92
AssertCommonErrorCasesFunction · 0.92
TestNewSMTPFunction · 0.92
TestQueueSMSFunction · 0.92
TestHandlerFunction · 0.92
TestQueueHTTPEmailFunction · 0.92
TestLoadTextTemplateFunction · 0.92
TestVerifyInvalidFunction · 0.92

Calls 5

NewFakeCSRFHandlerFunction · 0.92
WithHooksMethod · 0.80
WithCSRFHandlerMethod · 0.65

Tested by 15

TestCipherFunction · 0.74
TestNewSMTPFunction · 0.74
TestQueueSMSFunction · 0.74
TestHandlerFunction · 0.74
TestQueueHTTPEmailFunction · 0.74
TestLoadTextTemplateFunction · 0.74
TestVerifyInvalidFunction · 0.74
TestVerifyCodeInvalidFunction · 0.74