logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

totp_test.exs (685B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.MFA.TOTPTest do
  5. use Pleroma.DataCase, async: true
  6. alias Pleroma.MFA.TOTP
  7. import Pleroma.Tests.Helpers, only: [uri_equal?: 2]
  8. test "create provisioning_uri to generate qrcode" do
  9. uri =
  10. TOTP.provisioning_uri("test-secrcet", "test@example.com",
  11. issuer: "Plerome-42",
  12. digits: 8,
  13. period: 60
  14. )
  15. assert uri_equal?(
  16. uri,
  17. "otpauth://totp/test@example.com?digits=8&issuer=Plerome-42&period=60&secret=test-secrcet"
  18. )
  19. end
  20. end