9edb6fd54d130c4dfc4236ac94d0cf9bd302c0e8
[akkoma] / test / mfa / totp_test.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.MFA.TOTPTest do
6 use Pleroma.DataCase
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