X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fsalmon%2Fsalmon_test.exs;h=153ec41acf6fd997fce58366af1c8548d0c1ef42;hb=118d6dcdf4b2c81b4cbe51fd43977722b3eee164;hp=232082779fd8f13de9768c8363efbcbb0779b2b6;hpb=f168a1cbdc318ffaa2d8bc9fb561eb3dfdfb89d9;p=akkoma
diff --git a/test/web/salmon/salmon_test.exs b/test/web/salmon/salmon_test.exs
index 232082779..153ec41ac 100644
--- a/test/web/salmon/salmon_test.exs
+++ b/test/web/salmon/salmon_test.exs
@@ -1,10 +1,11 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2018 Pleroma Authors
+# Copyright © 2017-2019 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Salmon.SalmonTest do
use Pleroma.DataCase
alias Pleroma.Activity
+ alias Pleroma.Keys
alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.Web.Federator.Publisher
@@ -34,12 +35,6 @@ defmodule Pleroma.Web.Salmon.SalmonTest do
assert Salmon.decode_and_validate(@wrong_magickey, salmon) == :error
end
- test "generates an RSA private key pem" do
- {:ok, key} = Salmon.generate_rsa_pem()
- assert is_binary(key)
- assert Regex.match?(~r/RSA/, key)
- end
-
test "it encodes a magic key from a public key" do
key = Salmon.decode_key(@magickey)
magic_key = Salmon.encode_key(key)
@@ -51,18 +46,10 @@ defmodule Pleroma.Web.Salmon.SalmonTest do
_key = Salmon.decode_key(@magickey_friendica)
end
- test "returns a public and private key from a pem" do
- pem = File.read!("test/fixtures/private_key.pem")
- {:ok, private, public} = Salmon.keys_from_pem(pem)
-
- assert elem(private, 0) == :RSAPrivateKey
- assert elem(public, 0) == :RSAPublicKey
- end
-
test "encodes an xml payload with a private key" do
doc = File.read!("test/fixtures/incoming_note_activity.xml")
pem = File.read!("test/fixtures/private_key.pem")
- {:ok, private, public} = Salmon.keys_from_pem(pem)
+ {:ok, private, public} = Keys.keys_from_pem(pem)
# Let's try a roundtrip.
{:ok, salmon} = Salmon.encode(private, doc)
@@ -105,10 +92,10 @@ defmodule Pleroma.Web.Salmon.SalmonTest do
{:ok, activity} = Repo.insert(%Activity{data: activity_data, recipients: activity_data["to"]})
user = User.get_cached_by_ap_id(activity.data["actor"])
- {:ok, user} = Pleroma.Web.WebFinger.ensure_keys_present(user)
+ {:ok, user} = User.ensure_keys_present(user)
Salmon.publish(user, activity)
- assert called(Publisher.enqueue_one(Salmon, %{recipient: mentioned_user}))
+ assert called(Publisher.enqueue_one(Salmon, %{recipient_id: mentioned_user.id}))
end
end