From d3b01678545dc4ebb9f5ad883b734f25fd74328c Mon Sep 17 00:00:00 2001 From: lain Date: Sun, 25 Feb 2018 17:06:12 +0100 Subject: [PATCH] Fix salmon tests. --- lib/pleroma/user.ex | 11 +++++++++-- test/web/salmon/salmon_test.exs | 3 +-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index b16c1e342..c3fce17de 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -410,8 +410,15 @@ defmodule Pleroma.User do if user = get_by_ap_id(ap_id) do user else - with {:ok, user} <- ActivityPub.make_user_from_ap_id(ap_id) do - user + ap_try = ActivityPub.make_user_from_ap_id(ap_id) + + case ap_try do + {:ok, user} -> user + _ -> + case OStatus.make_user(ap_id) do + {:ok, user} -> user + _ -> {:error, "Could not fetch by ap id"} + end end end end diff --git a/test/web/salmon/salmon_test.exs b/test/web/salmon/salmon_test.exs index a1ba45e35..cf70c908f 100644 --- a/test/web/salmon/salmon_test.exs +++ b/test/web/salmon/salmon_test.exs @@ -59,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) @@ -86,7 +85,7 @@ 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)