Use TestMain to setup the database and shut it down after.
This commit is contained in:
parent
35d1b06a79
commit
63fdc06438
1 changed files with 6 additions and 1 deletions
|
@ -15,7 +15,6 @@ func deleteTestUser(username string) {
|
|||
|
||||
func TestLogin(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
data.Setup("sqlite3", "./db.sqlite3")
|
||||
deleteTestUser("testerzed")
|
||||
|
||||
ctx, cancel := Setup(5); defer cancel()
|
||||
|
@ -69,3 +68,9 @@ func TestStreamPage(t *testing.T) {
|
|||
|
||||
assert.Equal(title, "Past Streams")
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
data.Setup("sqlite3", "./db.sqlite3")
|
||||
m.Run()
|
||||
data.Shutdown()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue