From de58f630ee41d8672c7a4c644edb8b0b8b9c97e8 Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 20 Mar 2026 10:08:02 +0100 Subject: [PATCH] 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. --- pkg/db/fixtures/totp.yml | 10 ++-------- pkg/user/test.go | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/pkg/db/fixtures/totp.yml b/pkg/db/fixtures/totp.yml index 6eece9462..68da6b7fd 100644 --- a/pkg/db/fixtures/totp.yml +++ b/pkg/db/fixtures/totp.yml @@ -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' diff --git a/pkg/user/test.go b/pkg/user/test.go index 6ec443c4d..fd2bf21c9 100644 --- a/pkg/user/test.go +++ b/pkg/user/test.go @@ -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) }