1
0
mirror of https://git.pleroma.social/sjw/pleroma.git synced 2024-12-29 18:05:38 +01:00
pleroma/test/keys_test.exs
2019-05-22 03:58:15 +00:00

21 lines
498 B
Elixir

defmodule Pleroma.KeysTest do
use Pleroma.DataCase
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