MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / setupLedgerForge

Function setupLedgerForge

api/middleware/auth_test.go:18–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16)
17
18func setupLedgerForge(t *testing.T) (*ledgerforge.LedgerForge, error) {
19 t.Helper()
20
21 if testing.Short() {
22 t.Skip("skipping middleware integration tests in short mode")
23 }
24
25 config.MockConfig(&config.Configuration{
26 Redis: config.RedisConfig{Dns: "localhost:6379"},
27 DataSource: config.DataSourceConfig{Dns: "postgres://postgres:@localhost:5432/ledgerforge?sslmode=disable"},
28 })
29 cnf, err := config.Fetch()
30 if err != nil {
31 return nil, err
32 }
33 db, err := database.NewDataSource(cnf)
34 if err != nil {
35 return nil, err
36 }
37
38 return ledgerforge.NewLedgerForge(db)
39}
40
41func TestAuthMiddleware_Authenticate(t *testing.T) {
42 gin.SetMode(gin.TestMode)

Callers 1

Calls 4

MockConfigFunction · 0.92
FetchFunction · 0.92
NewDataSourceFunction · 0.92
NewLedgerForgeFunction · 0.92

Tested by

no test coverage detected