X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fsalmon%2Fsalmon_test.exs;h=cf70c908f364181779c3a68b20e07845e791382b;hb=611ca385dea3d611a97579000311cc42684305e6;hp=65d81e44fc923bb024571d5ea2adac2894419afe;hpb=70024632ba32121bd63a439b2d708d4b4ff1a190;p=akkoma diff --git a/test/web/salmon/salmon_test.exs b/test/web/salmon/salmon_test.exs index 65d81e44f..cf70c908f 100644 --- a/test/web/salmon/salmon_test.exs +++ b/test/web/salmon/salmon_test.exs @@ -8,6 +8,8 @@ defmodule Pleroma.Web.Salmon.SalmonTest do @wrong_magickey "RSA.pu0s-halox4tu7wmES1FVSx6u-4wc0YrUFXcqWXZG4-27UmbCOpMQftRCldNRfyA-qLbz-eqiwQhh-1EwUvjsD4cYbAHNGHwTvDOyx5AKthQUP44ykPv7kjKGh3DWKySJvcs9tlUG87hlo7AvnMo9pwRS_Zz2CacQ-MKaXyDepk=.AQAA" + @magickey_friendica "RSA.AMwa8FUs2fWEjX0xN7yRQgegQffhBpuKNC6fa5VNSVorFjGZhRrlPMn7TQOeihlc9lBz2OsHlIedbYn2uJ7yCs0.AQAB" + test "decodes a salmon" do {:ok, salmon} = File.read("test/fixtures/salmon.xml") {:ok, doc} = Salmon.decode_and_validate(@magickey, salmon) @@ -32,6 +34,10 @@ defmodule Pleroma.Web.Salmon.SalmonTest do assert @magickey == magic_key end + test "it decodes a friendica public key" 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) @@ -53,7 +59,6 @@ defmodule Pleroma.Web.Salmon.SalmonTest do end test "it gets a magic key" do - # TODO: Make test local salmon = File.read!("test/fixtures/salmon2.xml") {:ok, key} = Salmon.fetch_magic_key(salmon) @@ -80,11 +85,11 @@ defmodule Pleroma.Web.Salmon.SalmonTest do "context" => note.data["context"] } - {:ok, activity} = Repo.insert(%Activity{data: activity_data}) + {:ok, activity} = Repo.insert(%Activity{data: activity_data, recipients: activity_data["to"]}) user = Repo.get_by(User, ap_id: activity.data["actor"]) {:ok, user} = Pleroma.Web.WebFinger.ensure_keys_present(user) - poster = fn (url, data, headers) -> + poster = fn (url, _data, _headers, _options) -> assert url == "http://example.org/salmon" end Salmon.publish(user, activity, poster)