mirror of
https://github.com/aclindsa/moneygo.git
synced 2025-07-03 04:38:38 -04:00
Lay groundwork and move sessions to 'store'
This commit is contained in:
@ -2,12 +2,11 @@ package handlers_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"github.com/aclindsa/moneygo/internal/config"
|
||||
"github.com/aclindsa/moneygo/internal/db"
|
||||
"github.com/aclindsa/moneygo/internal/handlers"
|
||||
"github.com/aclindsa/moneygo/internal/models"
|
||||
"github.com/aclindsa/moneygo/internal/store/db"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
@ -253,24 +252,18 @@ func RunTests(m *testing.M) int {
|
||||
dsn = envDSN
|
||||
}
|
||||
|
||||
dsn = db.GetDSN(dbType, dsn)
|
||||
database, err := sql.Open(dbType.String(), dsn)
|
||||
db, err := db.GetStore(dbType, dsn)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer database.Close()
|
||||
defer db.Close()
|
||||
|
||||
dbmap, err := db.GetDbMap(database, dbType)
|
||||
err = db.DbMap.TruncateTables()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
err = dbmap.TruncateTables()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
server = httptest.NewTLSServer(&handlers.APIHandler{DB: dbmap})
|
||||
server = httptest.NewTLSServer(&handlers.APIHandler{Store: db})
|
||||
defer server.Close()
|
||||
|
||||
return m.Run()
|
||||
|
Reference in New Issue
Block a user