diff options
| author | Maksim <parallel588@gmail.com> | 2020-05-07 08:14:54 +0000 |
|---|---|---|
| committer | lain <lain@soykaf.club> | 2020-05-07 08:14:54 +0000 |
| commit | 3d0c567fbc3506770fdac5f1269c45b244928747 (patch) | |
| tree | a7f4ece6dcd0a534b464e455fa382d3ebd8f4d07 /test/mfa | |
| parent | 68a126317d7cdd670c8e244319da08ff85639d33 (diff) | |
| download | pleroma-3d0c567fbc3506770fdac5f1269c45b244928747.tar.gz pleroma-3d0c567fbc3506770fdac5f1269c45b244928747.zip | |
Pleroma.Web.TwitterAPI.TwoFactorAuthenticationController -> Pleroma.Web.PleromaAPI.TwoFactorAuthenticationController
Diffstat (limited to 'test/mfa')
| -rw-r--r-- | test/mfa/backup_codes_test.exs | 11 | ||||
| -rw-r--r-- | test/mfa/totp_test.exs | 17 |
2 files changed, 28 insertions, 0 deletions
diff --git a/test/mfa/backup_codes_test.exs b/test/mfa/backup_codes_test.exs new file mode 100644 index 000000000..7bc01b36b --- /dev/null +++ b/test/mfa/backup_codes_test.exs @@ -0,0 +1,11 @@ +defmodule Pleroma.MFA.BackupCodesTest do + use Pleroma.DataCase + + alias Pleroma.MFA.BackupCodes + + test "generate backup codes" do + codes = BackupCodes.generate(number_of_codes: 2, length: 4) + + assert [<<_::bytes-size(4)>>, <<_::bytes-size(4)>>] = codes + end +end diff --git a/test/mfa/totp_test.exs b/test/mfa/totp_test.exs new file mode 100644 index 000000000..50153d208 --- /dev/null +++ b/test/mfa/totp_test.exs @@ -0,0 +1,17 @@ +defmodule Pleroma.MFA.TOTPTest do + use Pleroma.DataCase + + alias Pleroma.MFA.TOTP + + test "create provisioning_uri to generate qrcode" do + uri = + TOTP.provisioning_uri("test-secrcet", "test@example.com", + issuer: "Plerome-42", + digits: 8, + period: 60 + ) + + assert uri == + "otpauth://totp/test@example.com?digits=8&issuer=Plerome-42&period=60&secret=test-secrcet" + end +end |
