fix: update TOTP reuse test to use user10 matching rebased fixture

This commit is contained in:
kolaente 2026-03-20 10:26:42 +01:00 committed by kolaente
parent 5f06e1dce5
commit acafa6db10
2 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,11 @@
- id: 1
user_id: 1
user_id: 10
secret: 'JBSWY3DPEHPK3PXP'
enabled: true
url: 'otpauth://totp/Vikunja:user1?secret=JBSWY3DPEHPK3PXP&issuer=Vikunja'
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'

View File

@ -32,12 +32,13 @@ func TestTOTPPasscodeCannotBeReused(t *testing.T) {
s := db.NewSession()
defer s.Close()
// Generate a valid TOTP passcode for user1's secret from the fixture
// Generate a valid TOTP passcode for user10's secret from the fixture
// user10 has TOTP enabled with this secret in pkg/db/fixtures/totp.yml
secret := "JBSWY3DPEHPK3PXP" //nolint:gosec
passcode, err := totp.GenerateCode(secret, time.Now())
require.NoError(t, err)
user := &User{ID: 1}
user := &User{ID: 10}
// First use should succeed
_, err = ValidateTOTPPasscode(s, &TOTPPasscode{