diff options
| author | lain <lain@soykaf.club> | 2019-10-02 13:27:55 +0200 |
|---|---|---|
| committer | lain <lain@soykaf.club> | 2019-10-02 13:27:55 +0200 |
| commit | 557223b2b5b60956d3e1a19e9fdae9e9798c4fe2 (patch) | |
| tree | 71d711f8932a2bd952f9f54ccef1322c55aed1d7 /test/web/activity_pub/activity_pub_test.exs | |
| parent | 19bc0b8c79765dc485e081651a4e4c589d18b970 (diff) | |
| parent | 433f2c0f6854d2838819e08f0fb0a9e8cf058021 (diff) | |
| download | pleroma-557223b2b5b60956d3e1a19e9fdae9e9798c4fe2.tar.gz pleroma-557223b2b5b60956d3e1a19e9fdae9e9798c4fe2.zip | |
Merge remote-tracking branch 'origin/develop' into reactions
Diffstat (limited to 'test/web/activity_pub/activity_pub_test.exs')
| -rw-r--r-- | test/web/activity_pub/activity_pub_test.exs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index 5a6464350..8c9c2c89e 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -887,6 +887,39 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do end end + describe "announcing a private object" do + test "adds an announce activity to the db if the audience is not widened" do + user = insert(:user) + {:ok, note_activity} = CommonAPI.post(user, %{"status" => ".", "visibility" => "private"}) + object = Object.normalize(note_activity) + + {:ok, announce_activity, object} = ActivityPub.announce(user, object, nil, true, false) + + assert announce_activity.data["to"] == [User.ap_followers(user)] + + assert announce_activity.data["object"] == object.data["id"] + assert announce_activity.data["actor"] == user.ap_id + assert announce_activity.data["context"] == object.data["context"] + end + + test "does not add an announce activity to the db if the audience is widened" do + user = insert(:user) + {:ok, note_activity} = CommonAPI.post(user, %{"status" => ".", "visibility" => "private"}) + object = Object.normalize(note_activity) + + assert {:error, _} = ActivityPub.announce(user, object, nil, true, true) + end + + test "does not add an announce activity to the db if the announcer is not the author" do + user = insert(:user) + announcer = insert(:user) + {:ok, note_activity} = CommonAPI.post(user, %{"status" => ".", "visibility" => "private"}) + object = Object.normalize(note_activity) + + assert {:error, _} = ActivityPub.announce(announcer, object, nil, true, false) + end + end + describe "unannouncing an object" do test "unannouncing a previously announced object" do note_activity = insert(:note_activity) |
