diff options
author | rinpatch <rinpatch@sdf.org> | 2020-05-02 12:24:49 +0000 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-05-02 18:59:12 +0300 |
commit | c75840f7b8a117e973713c8cb47523f09deaab79 (patch) | |
tree | b57e316cea93db13e0572b98d533725fa152b363 /test | |
parent | 7b0593367756adc459a7b7bbaa0ace567b97742f (diff) | |
download | pleroma-c75840f7b8a117e973713c8cb47523f09deaab79.tar.gz pleroma-c75840f7b8a117e973713c8cb47523f09deaab79.zip |
Merge branch 'follow-request-notifications' into 'develop'
Follow request notifications enforcement
See merge request pleroma/pleroma!2451
Diffstat (limited to 'test')
-rw-r--r-- | test/notification_test.exs | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/test/notification_test.exs b/test/notification_test.exs index 8553d9652..e12418db3 100644 --- a/test/notification_test.exs +++ b/test/notification_test.exs @@ -312,9 +312,7 @@ defmodule Pleroma.NotificationTest do }) end - test "if `follow_request` notifications are enabled, " <> - "it creates `follow_request` notification for pending Follow activity" do - clear_config([:notifications, :enable_follow_request_notifications], true) + test "it creates `follow_request` notification for pending Follow activity" do user = insert(:user) followed_user = insert(:user, locked: true) @@ -333,21 +331,6 @@ defmodule Pleroma.NotificationTest do assert %{type: "follow"} = NotificationView.render("show.json", render_opts) end - test "if `follow_request` notifications are disabled, " <> - "it does NOT create `follow*` notification for pending Follow activity" do - clear_config([:notifications, :enable_follow_request_notifications], false) - user = insert(:user) - followed_user = insert(:user, locked: true) - - {:ok, _, _, _activity} = CommonAPI.follow(user, followed_user) - refute FollowingRelationship.following?(user, followed_user) - assert [] = Notification.for_user(followed_user) - - # After request is accepted, no new notifications are generated: - assert {:ok, _} = CommonAPI.accept_follow_request(user, followed_user) - assert [] = Notification.for_user(followed_user) - end - test "it doesn't create a notification for follow-unfollow-follow chains" do user = insert(:user) followed_user = insert(:user, locked: false) @@ -362,6 +345,15 @@ defmodule Pleroma.NotificationTest do notification_id = notification.id assert [%{id: ^notification_id}] = Notification.for_user(followed_user) end + + test "dismisses the notification on follow request rejection" do + user = insert(:user, locked: true) + follower = insert(:user) + {:ok, _, _, _follow_activity} = CommonAPI.follow(follower, user) + assert [notification] = Notification.for_user(user) + {:ok, _follower} = CommonAPI.reject_follow_request(follower, user) + assert [] = Notification.for_user(user) + end end describe "get notification" do |