test: add TOTP fixture and load it in user test bootstrap

Add a TOTP fixture for user1 with a known secret to enable
testing TOTP validation logic. Update InitTests to load the
totp fixture alongside users and user_tokens.
This commit is contained in:
kolaente 2026-03-20 10:08:02 +01:00 committed by kolaente
parent 8bf450b98f
commit de58f630ee
2 changed files with 3 additions and 9 deletions

View File

@ -1,11 +1,5 @@
- id: 1
user_id: 10
user_id: 1
secret: 'JBSWY3DPEHPK3PXP'
enabled: true
url: 'otpauth://totp/Vikunja:user10?secret=JBSWY3DPEHPK3PXP&issuer=Vikunja'
# user1 has TOTP enrolled but not yet enabled — used by existing TOTP enrollment tests
- id: 2
user_id: 1
secret: 'HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ'
enabled: false
url: 'otpauth://totp/Vikunja:user1?secret=HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ&issuer=Vikunja'
url: 'otpauth://totp/Vikunja:user1?secret=JBSWY3DPEHPK3PXP&issuer=Vikunja'

View File

@ -37,7 +37,7 @@ func InitTests() {
log.Fatal(err)
}
err = db.InitTestFixtures("users", "user_tokens")
err = db.InitTestFixtures("users", "user_tokens", "totp")
if err != nil {
log.Fatal(err)
}