diff options
| author | Ariadne Conill <ariadne@dereferenced.org> | 2019-09-27 12:22:35 +0000 | 
|---|---|---|
| committer | Ariadne Conill <ariadne@dereferenced.org> | 2019-09-30 10:39:17 +0000 | 
| commit | 1f9de2a8cdc1913b26afab1f914aea526db608d8 (patch) | |
| tree | c2edcc262d7c87d8a28ded2c55f68637b567c488 /test/web/activity_pub | |
| parent | b7877e9b1c61e42d60bb65deef0cec7f1103dd89 (diff) | |
| download | pleroma-1f9de2a8cdc1913b26afab1f914aea526db608d8.tar.gz pleroma-1f9de2a8cdc1913b26afab1f914aea526db608d8.zip | |
activitypub: implement IR-level considerations for Listen activities
Diffstat (limited to 'test/web/activity_pub')
| -rw-r--r-- | test/web/activity_pub/activity_pub_test.exs | 36 | 
1 files changed, 36 insertions, 0 deletions
| diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index f28fd6871..a203d1d30 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -257,6 +257,42 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do      end    end +  describe "listen activities" do +    test "does not increase user note count" do +      user = insert(:user) + +      {:ok, activity} = +        ActivityPub.listen(%{ +          to: ["https://www.w3.org/ns/activitystreams#Public"], +          actor: user, +          context: "", +          object: %{ +            "actor" => user.ap_id, +            "to" => ["https://www.w3.org/ns/activitystreams#Public"], +            "artist" => "lain", +            "title" => "lain radio episode 1", +            "length" => 180_000, +            "type" => "Audio" +          } +        }) + +      assert activity.actor == user.ap_id + +      user = User.get_cached_by_id(user.id) +      assert user.info.note_count == 0 +    end + +    test "can be fetched into a timeline" do +      _listen_activity_1 = insert(:listen) +      _listen_activity_2 = insert(:listen) +      _listen_activity_3 = insert(:listen) + +      timeline = ActivityPub.fetch_activities([], %{"type" => ["Listen"]}) + +      assert length(timeline) == 3 +    end +  end +    describe "create activities" do      test "removes doubled 'to' recipients" do        user = insert(:user) | 
