56e4f48ed23a9e97fa42157b4166dde7802e502a
[anni] / test / pleroma / mfa / totp_test.exs
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
5 defmodule Pleroma.MFA.TOTPTest do
6   use Pleroma.DataCase, async: true
7
8   alias Pleroma.MFA.TOTP
9
10   test "create provisioning_uri to generate qrcode" do
11     uri =
12       TOTP.provisioning_uri("test-secrcet", "test@example.com",
13         issuer: "Plerome-42",
14         digits: 8,
15         period: 60
16       )
17
18     assert uri ==
19              "otpauth://totp/test@example.com?digits=8&issuer=Plerome-42&period=60&secret=test-secrcet"
20   end
21 end