forked from AkkomaGang/akkoma
tests: add tests for non-follows/non-followers settings
This commit is contained in:
parent
1542cccbbc
commit
0f7eeb0943
1 changed files with 14 additions and 0 deletions
|
@ -113,6 +113,13 @@ test "it disables notifications from followers" do
|
||||||
assert nil == Notification.create_notification(activity, followed)
|
assert nil == Notification.create_notification(activity, followed)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "it disables notifications from non-followers" do
|
||||||
|
follower = insert(:user)
|
||||||
|
followed = insert(:user, info: %{notification_settings: %{"non_followers" => false}})
|
||||||
|
{:ok, activity} = CommonAPI.post(follower, %{"status" => "hey @#{followed.nickname}"})
|
||||||
|
assert nil == Notification.create_notification(activity, followed)
|
||||||
|
end
|
||||||
|
|
||||||
test "it disables notifications from people the user follows" do
|
test "it disables notifications from people the user follows" do
|
||||||
follower = insert(:user, info: %{notification_settings: %{"follows" => false}})
|
follower = insert(:user, info: %{notification_settings: %{"follows" => false}})
|
||||||
followed = insert(:user)
|
followed = insert(:user)
|
||||||
|
@ -122,6 +129,13 @@ test "it disables notifications from people the user follows" do
|
||||||
assert nil == Notification.create_notification(activity, follower)
|
assert nil == Notification.create_notification(activity, follower)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "it disables notifications from people the user does not follow" do
|
||||||
|
follower = insert(:user, info: %{notification_settings: %{"non_follows" => false}})
|
||||||
|
followed = insert(:user)
|
||||||
|
{:ok, activity} = CommonAPI.post(followed, %{"status" => "hey @#{follower.nickname}"})
|
||||||
|
assert nil == Notification.create_notification(activity, follower)
|
||||||
|
end
|
||||||
|
|
||||||
test "it doesn't create a notification for user if he is the activity author" do
|
test "it doesn't create a notification for user if he is the activity author" do
|
||||||
activity = insert(:note_activity)
|
activity = insert(:note_activity)
|
||||||
author = User.get_cached_by_ap_id(activity.data["actor"])
|
author = User.get_cached_by_ap_id(activity.data["actor"])
|
||||||
|
|
Loading…
Reference in a new issue