diff options
| author | lain <lain@soykaf.club> | 2019-01-25 17:55:24 +0100 | 
|---|---|---|
| committer | lain <lain@soykaf.club> | 2019-01-25 18:14:48 +0100 | 
| commit | aa8ddfdbe2303375e3f019faca30a620bfc58fc7 (patch) | |
| tree | 35120f7e0b6d4c64855e81e78f0bcbe3938964ba /test | |
| parent | bd6c12592e9ae9548172c605d00650d4d6b734dc (diff) | |
| download | pleroma-aa8ddfdbe2303375e3f019faca30a620bfc58fc7.tar.gz pleroma-aa8ddfdbe2303375e3f019faca30a620bfc58fc7.zip | |
SPC fixes: Fix activities.
Diffstat (limited to 'test')
| -rw-r--r-- | test/spc_fixes_test.exs | 16 | 
1 files changed, 15 insertions, 1 deletions
| diff --git a/test/spc_fixes_test.exs b/test/spc_fixes_test.exs index 01629e374..76c081248 100644 --- a/test/spc_fixes_test.exs +++ b/test/spc_fixes_test.exs @@ -9,6 +9,8 @@ defmodule Pleroma.SpcFixesTest do    alias Pleroma.Web.CommonAPI    alias Pleroma.Web.ActivityPub.ActivityPub    alias Pleroma.User +  alias Pleroma.Activity +  alias Pleroma.Repo    import Pleroma.Factory @@ -33,6 +35,7 @@ defmodule Pleroma.SpcFixesTest do      other_user = insert(:user)      {:ok, other_user} = User.follow(other_user, user)      {:ok, activity} = CommonAPI.post(user, %{"status" => "blabla"}) +    {:ok, _other_activity} = CommonAPI.post(other_user, %{"status" => "blabla"})      assert User.following?(other_user, user)      assert [activity] == ActivityPub.fetch_activities(other_user.following) @@ -45,8 +48,19 @@ defmodule Pleroma.SpcFixesTest do      assert user.ap_id == "https://shitposter.club/users/zep"      assert user.follower_address == "https://shitposter.club/users/zep/followers" +    aid = activity.id      # Activites and following are correctly stitched.      assert User.following?(other_user, user) -    assert [activity] == ActivityPub.fetch_activities(other_user.following) |> IO.inspect() +    assert [%{id: ^aid}] = ActivityPub.fetch_activities(other_user.following) + +    third_user = insert(:user) +    {:ok, third_user} = User.follow(third_user, user) +    assert [%{id: ^aid}] = ActivityPub.fetch_activities(third_user.following) + +    activity = Repo.get(Activity, aid) + +    assert activity.data["actor"] == user.ap_id +    assert user.follower_address in activity.recipients +    assert user.follower_address in activity.data["to"]    end  end | 
