Use background context in tests

This commit is contained in:
Simon Ser 2021-11-17 12:04:24 +01:00
parent 7160713ea9
commit 2381e14d6a

View File

@ -44,7 +44,7 @@ func createTestUser(t *testing.T, db Database) *User {
} }
record := &User{Username: testUsername, Password: string(hashed)} record := &User{Username: testUsername, Password: string(hashed)}
if err := db.StoreUser(context.TODO(), record); err != nil { if err := db.StoreUser(context.Background(), record); err != nil {
t.Fatalf("failed to store test user: %v", err) t.Fatalf("failed to store test user: %v", err)
} }
@ -69,7 +69,7 @@ func createTestUpstream(t *testing.T, db Database, user *User) (*Network, net.Li
Nick: user.Username, Nick: user.Username,
Enabled: true, Enabled: true,
} }
if err := db.StoreNetwork(context.TODO(), user.ID, network); err != nil { if err := db.StoreNetwork(context.Background(), user.ID, network); err != nil {
t.Fatalf("failed to store test network: %v", err) t.Fatalf("failed to store test network: %v", err)
} }