test: add edge case tests for TotpService #67

Open
Charon wants to merge 1 commit from feat/totp-edge-case-tests into dev
Member

Fixes #17

Summary

  • Add 37 Pest tests covering TotpService edge cases
  • Clock drift: acceptance within WINDOW=1, rejection beyond tolerance
  • Malformed base32 secrets: lowercase, padding, invalid chars, empty
  • Code format: spaces, dashes, too short/long, alphabetic, whitespace
  • Replay behaviour: documents no built-in replay protection
  • Cross-secret rejection: code from secret A rejected by secret B
  • Base32 round-trips: binary data, known vector, empty, boundary bytes
  • RFC 6238 conformance: determinism, zero-padding, period variation

Test plan

  • All 37 tests pass (53 assertions)
  • Pint lint passes
  • No database dependencies (pure unit tests of TotpService)
Fixes #17 ## Summary - Add 37 Pest tests covering TotpService edge cases - Clock drift: acceptance within WINDOW=1, rejection beyond tolerance - Malformed base32 secrets: lowercase, padding, invalid chars, empty - Code format: spaces, dashes, too short/long, alphabetic, whitespace - Replay behaviour: documents no built-in replay protection - Cross-secret rejection: code from secret A rejected by secret B - Base32 round-trips: binary data, known vector, empty, boundary bytes - RFC 6238 conformance: determinism, zero-padding, period variation ## Test plan - [x] All 37 tests pass (53 assertions) - [x] Pint lint passes - [x] No database dependencies (pure unit tests of TotpService)
Charon added 1 commit 2026-03-24 13:37:02 +00:00
Add 37 Pest tests covering TotpService edge cases that were previously
untested: clock drift acceptance/rejection across time windows, malformed
base32 secrets (lowercase, padding, invalid chars, empty), code format
handling (spaces, dashes, too short/long, alphabetic, whitespace),
replay behaviour documentation, cross-secret rejection, base32
encode/decode round-trips (binary, empty, boundary bytes), and RFC 6238
conformance (determinism, zero-padding, period variation).

Fixes #17

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/totp-edge-case-tests:feat/totp-edge-case-tests
git checkout feat/totp-edge-case-tests

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout dev
git merge --no-ff feat/totp-edge-case-tests
git checkout feat/totp-edge-case-tests
git rebase dev
git checkout dev
git merge --ff-only feat/totp-edge-case-tests
git checkout feat/totp-edge-case-tests
git rebase dev
git checkout dev
git merge --no-ff feat/totp-edge-case-tests
git checkout dev
git merge --squash feat/totp-edge-case-tests
git checkout dev
git merge --ff-only feat/totp-edge-case-tests
git checkout dev
git merge feat/totp-edge-case-tests
git push origin dev
Sign in to join this conversation.
No description provided.