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)
| 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. |
| 63 | func 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! |
| 77 | func NewRegistryDefaultWithDSN(t testing.TB, dsn string, opts ...configx.OptionModifier) (*config.Config, *driver.RegistryDefault) { |