MCPcopy Index your code
hub / github.com/dnote/dnote / LoginDB

Function LoginDB

pkg/cli/testutils/main.go:49–52  ·  view source on GitHub ↗

LoginDB sets up login credentials in the database for tests

(t *testing.T, db *database.DB)

Source from the content-addressed store, hash-verified

47
48// LoginDB sets up login credentials in the database for tests
49func LoginDB(t *testing.T, db *database.DB) {
50 database.MustExec(t, "inserting sessionKey", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemSessionKey, "someSessionKey")
51 database.MustExec(t, "inserting sessionKeyExpiry", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemSessionKeyExpiry, time.Now().Add(24*time.Hour).Unix())
52}
53
54// Login simulates a logged in user by inserting credentials in the local database
55func Login(t *testing.T, ctx *context.DnoteCtx) {

Callers 2

TestSaveServerStateFunction · 0.92
LoginFunction · 0.85

Calls 2

MustExecFunction · 0.92
NowMethod · 0.65

Tested by 1

TestSaveServerStateFunction · 0.74