mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-26 16:02:18 +00:00
9ba60f70d2
In general, tests that match these criteria can be made async: - Doesn't use real Cachex. - Doesn't write to the Config / Application Environment. - Uses Mock. Using Mox is fine. - Uses the streamer.
25 lines
670 B
Elixir
25 lines
670 B
Elixir
# Pleroma: A lightweight social networking server
|
|
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
defmodule Pleroma.KeysTest do
|
|
use Pleroma.DataCase, async: true
|
|
|
|
alias Pleroma.Keys
|
|
|
|
test "generates an RSA private key pem" do
|
|
{:ok, key} = Keys.generate_rsa_pem()
|
|
|
|
assert is_binary(key)
|
|
assert Regex.match?(~r/RSA/, key)
|
|
end
|
|
|
|
test "returns a public and private key from a pem" do
|
|
pem = File.read!("test/fixtures/private_key.pem")
|
|
{:ok, private, public} = Keys.keys_from_pem(pem)
|
|
|
|
assert elem(private, 0) == :RSAPrivateKey
|
|
assert elem(public, 0) == :RSAPublicKey
|
|
end
|
|
end
|