mirror of
https://github.com/dnote/dnote
synced 2026-03-17 07:55:50 +01:00
Write migration and test
This commit is contained in:
parent
78d941da90
commit
4fe23fe996
21 changed files with 1435 additions and 1185 deletions
|
|
@ -48,12 +48,15 @@ const (
|
|||
// Timeout for waiting for prompts in tests
|
||||
const promptTimeout = 10 * time.Second
|
||||
|
||||
// Login simulates a logged in user by inserting credentials in the local database
|
||||
func Login(t *testing.T, ctx *context.DnoteCtx) {
|
||||
db := ctx.DB
|
||||
|
||||
// LoginDB sets up login credentials in the database for tests
|
||||
func LoginDB(t *testing.T, db *database.DB) {
|
||||
database.MustExec(t, "inserting sessionKey", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemSessionKey, "someSessionKey")
|
||||
database.MustExec(t, "inserting sessionKeyExpiry", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemSessionKeyExpiry, time.Now().Add(24*time.Hour).Unix())
|
||||
}
|
||||
|
||||
// Login simulates a logged in user by inserting credentials in the local database
|
||||
func Login(t *testing.T, ctx *context.DnoteCtx) {
|
||||
LoginDB(t, ctx.DB)
|
||||
|
||||
ctx.SessionKey = "someSessionKey"
|
||||
ctx.SessionKeyExpiry = time.Now().Add(24 * time.Hour).Unix()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue