summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMark Felder <feld@feld.me>2024-08-07 12:37:58 -0400
committerMark Felder <feld@feld.me>2024-08-07 12:39:58 -0400
commit06e8ece4cc3956d991d48dbd338604b7940d167c (patch)
tree2b97f801a86c8a3f46d6863c4cfc37104ae234f9 /test
parent9d27a074c1b3ad1f130089f62b9eb4f319866d86 (diff)
downloadpleroma-06e8ece4cc3956d991d48dbd338604b7940d167c.tar.gz
pleroma-06e8ece4cc3956d991d48dbd338604b7940d167c.zip
Fix CommonAPI.follow/2 which returned users in the reverse order they were provided to the function
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/web/activity_pub/activity_pub_controller_test.exs4
-rw-r--r--test/pleroma/web/activity_pub/views/user_view_test.exs8
-rw-r--r--test/pleroma/web/common_api_test.exs10
-rw-r--r--test/pleroma/web/mastodon_api/views/account_view_test.exs18
-rw-r--r--test/pleroma/web/mastodon_api/views/notification_view_test.exs2
-rw-r--r--test/pleroma/web/views/streamer_view_test.ex6
6 files changed, 24 insertions, 24 deletions
diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs
index 6aae61835..af1a32fed 100644
--- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs
+++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs
@@ -1747,7 +1747,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
%{conn: conn} do
user = insert(:user, hide_followers: true)
other_user = insert(:user)
- {:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
+ {:ok, user, _other_user, _activity} = CommonAPI.follow(user, other_user)
result =
conn
@@ -1843,7 +1843,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
%{conn: conn} do
user = insert(:user, hide_follows: true)
other_user = insert(:user)
- {:ok, user, _other_user, _activity} = CommonAPI.follow(other_user, user)
+ {:ok, _other_user, user, _activity} = CommonAPI.follow(other_user, user)
result =
conn
diff --git a/test/pleroma/web/activity_pub/views/user_view_test.exs b/test/pleroma/web/activity_pub/views/user_view_test.exs
index c94f8a2bc..651e535ac 100644
--- a/test/pleroma/web/activity_pub/views/user_view_test.exs
+++ b/test/pleroma/web/activity_pub/views/user_view_test.exs
@@ -138,7 +138,7 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do
test "sets totalItems to zero when followers are hidden" do
user = insert(:user)
other_user = insert(:user)
- {:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
+ {:ok, user, _other_user, _activity} = CommonAPI.follow(user, other_user)
assert %{"totalItems" => 1} = UserView.render("followers.json", %{user: user})
user = Map.merge(user, %{hide_followers_count: true, hide_followers: true})
refute UserView.render("followers.json", %{user: user}) |> Map.has_key?("totalItems")
@@ -147,7 +147,7 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do
test "sets correct totalItems when followers are hidden but the follower counter is not" do
user = insert(:user)
other_user = insert(:user)
- {:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
+ {:ok, user, _other_user, _activity} = CommonAPI.follow(user, other_user)
assert %{"totalItems" => 1} = UserView.render("followers.json", %{user: user})
user = Map.merge(user, %{hide_followers_count: false, hide_followers: true})
assert %{"totalItems" => 1} = UserView.render("followers.json", %{user: user})
@@ -158,7 +158,7 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do
test "sets totalItems to zero when follows are hidden" do
user = insert(:user)
other_user = insert(:user)
- {:ok, user, _other_user, _activity} = CommonAPI.follow(other_user, user)
+ {:ok, _other_user, user, _activity} = CommonAPI.follow(other_user, user)
assert %{"totalItems" => 1} = UserView.render("following.json", %{user: user})
user = Map.merge(user, %{hide_follows_count: true, hide_follows: true})
assert %{"totalItems" => 0} = UserView.render("following.json", %{user: user})
@@ -167,7 +167,7 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do
test "sets correct totalItems when follows are hidden but the follow counter is not" do
user = insert(:user)
other_user = insert(:user)
- {:ok, user, _other_user, _activity} = CommonAPI.follow(other_user, user)
+ {:ok, _other_user, user, _activity} = CommonAPI.follow(other_user, user)
assert %{"totalItems" => 1} = UserView.render("following.json", %{user: user})
user = Map.merge(user, %{hide_follows_count: false, hide_follows: true})
assert %{"totalItems" => 1} = UserView.render("following.json", %{user: user})
diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs
index 4cdd3cffa..73230a58c 100644
--- a/test/pleroma/web/common_api_test.exs
+++ b/test/pleroma/web/common_api_test.exs
@@ -1420,7 +1420,7 @@ defmodule Pleroma.Web.CommonAPITest do
describe "follow/2" do
test "directly follows a non-locked local user" do
[follower, followed] = insert_pair(:user)
- {:ok, follower, followed, _} = CommonAPI.follow(followed, follower)
+ {:ok, followed, follower, _} = CommonAPI.follow(followed, follower)
assert User.following?(follower, followed)
end
@@ -1429,7 +1429,7 @@ defmodule Pleroma.Web.CommonAPITest do
describe "unfollow/2" do
test "also unsubscribes a user" do
[follower, followed] = insert_pair(:user)
- {:ok, follower, followed, _} = CommonAPI.follow(followed, follower)
+ {:ok, followed, follower, _} = CommonAPI.follow(followed, follower)
{:ok, _subscription} = User.subscribe(follower, followed)
assert User.subscribed_to?(follower, followed)
@@ -1441,7 +1441,7 @@ defmodule Pleroma.Web.CommonAPITest do
test "also unpins a user" do
[follower, followed] = insert_pair(:user)
- {:ok, follower, followed, _} = CommonAPI.follow(followed, follower)
+ {:ok, followed, follower, _} = CommonAPI.follow(followed, follower)
{:ok, _endorsement} = User.endorse(follower, followed)
assert User.endorses?(follower, followed)
@@ -1455,7 +1455,7 @@ defmodule Pleroma.Web.CommonAPITest do
follower = insert(:user)
followed = insert(:user, is_locked: true)
- assert {:ok, follower, followed, %{id: activity_id, data: %{"state" => "pending"}}} =
+ assert {:ok, followed, follower, %{id: activity_id, data: %{"state" => "pending"}}} =
CommonAPI.follow(followed, follower)
assert User.get_follow_state(follower, followed) == :follow_pending
@@ -1477,7 +1477,7 @@ defmodule Pleroma.Web.CommonAPITest do
follower = insert(:user)
followed = insert(:user, is_locked: true, local: false)
- assert {:ok, follower, followed, %{id: activity_id, data: %{"state" => "pending"}}} =
+ assert {:ok, followed, follower, %{id: activity_id, data: %{"state" => "pending"}}} =
CommonAPI.follow(followed, follower)
assert User.get_follow_state(follower, followed) == :follow_pending
diff --git a/test/pleroma/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs
index f0711fa0d..dca64853d 100644
--- a/test/pleroma/web/mastodon_api/views/account_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs
@@ -493,7 +493,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
user = insert(:user)
other_user = insert(:user, is_locked: true)
- {:ok, user, other_user, _} = CommonAPI.follow(other_user, user)
+ {:ok, other_user, user, _} = CommonAPI.follow(other_user, user)
user = User.get_cached_by_id(user.id)
other_user = User.get_cached_by_id(other_user.id)
@@ -560,8 +560,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
test "shows when follows/followers are hidden" do
user = insert(:user, hide_followers: true, hide_follows: true)
other_user = insert(:user)
- {:ok, user, other_user, _activity} = CommonAPI.follow(other_user, user)
- {:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
+ {:ok, other_user, user, _activity} = CommonAPI.follow(other_user, user)
+ {:ok, user, _other_user, _activity} = CommonAPI.follow(user, other_user)
assert %{
followers_count: 1,
@@ -573,11 +573,11 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
test "shows actual follower/following count to the account owner" do
user = insert(:user, hide_followers: true, hide_follows: true)
other_user = insert(:user)
- {:ok, user, other_user, _activity} = CommonAPI.follow(other_user, user)
+ {:ok, other_user, user, _activity} = CommonAPI.follow(other_user, user)
assert User.following?(user, other_user)
assert Pleroma.FollowingRelationship.follower_count(other_user) == 1
- {:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
+ {:ok, user, _other_user, _activity} = CommonAPI.follow(user, other_user)
assert %{
followers_count: 1,
@@ -696,7 +696,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user})
other_user = insert(:user)
- {:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
+ {:ok, user, _other_user, _activity} = CommonAPI.follow(user, other_user)
assert %{locked: true, follow_requests_count: 1} =
AccountView.render("show.json", %{user: user, for: user})
@@ -708,7 +708,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user})
other_user = insert(:user)
- {:ok, other_user, user, _activity} = CommonAPI.follow(user, other_user)
+ {:ok, user, other_user, _activity} = CommonAPI.follow(user, other_user)
assert %{locked: true, follow_requests_count: 1} =
AccountView.render("show.json", %{user: user, for: user})
@@ -725,7 +725,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user})
other_user = insert(:user)
- {:ok, other_user, user, _activity} = CommonAPI.follow(user, other_user)
+ {:ok, user, other_user, _activity} = CommonAPI.follow(user, other_user)
assert %{locked: true, follow_requests_count: 1} =
AccountView.render("show.json", %{user: user, for: user})
@@ -742,7 +742,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user})
other_user = insert(:user)
- {:ok, _other_user, user, _activity} = CommonAPI.follow(user, other_user)
+ {:ok, user, _other_user, _activity} = CommonAPI.follow(user, other_user)
{:ok, user} = User.update_and_set_cache(user, %{is_locked: false})
diff --git a/test/pleroma/web/mastodon_api/views/notification_view_test.exs b/test/pleroma/web/mastodon_api/views/notification_view_test.exs
index fae672871..75ab375aa 100644
--- a/test/pleroma/web/mastodon_api/views/notification_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/notification_view_test.exs
@@ -132,7 +132,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do
test "Follow notification" do
follower = insert(:user)
followed = insert(:user)
- {:ok, follower, followed, _activity} = CommonAPI.follow(followed, follower)
+ {:ok, followed, follower, _activity} = CommonAPI.follow(followed, follower)
notification = Notification |> Repo.one() |> Repo.preload(:activity)
expected = %{
diff --git a/test/pleroma/web/views/streamer_view_test.ex b/test/pleroma/web/views/streamer_view_test.ex
index 43a17a43e..b1c5f52ab 100644
--- a/test/pleroma/web/views/streamer_view_test.ex
+++ b/test/pleroma/web/views/streamer_view_test.ex
@@ -17,7 +17,7 @@ defmodule Pleroma.Web.StreamerViewTest do
follower = insert(:user)
{:ok, _, _, _} = CommonAPI.follow(other_user, following)
- {:ok, follower, following, _activity} = CommonAPI.follow(following, follower)
+ {:ok, following, follower, _activity} = CommonAPI.follow(following, follower)
result =
StreamerView.render(
@@ -46,7 +46,7 @@ defmodule Pleroma.Web.StreamerViewTest do
follower = insert(:user)
{:ok, _, _, _} = CommonAPI.follow(other_user, following)
- {:ok, follower, following, _activity} = CommonAPI.follow(following, follower)
+ {:ok, following, follower, _activity} = CommonAPI.follow(following, follower)
result =
StreamerView.render(
@@ -76,7 +76,7 @@ defmodule Pleroma.Web.StreamerViewTest do
follower = insert(:user)
{:ok, _, _, _} = CommonAPI.follow(other_user, following)
- {:ok, follower, following, _activity} = CommonAPI.follow(following, follower)
+ {:ok, following, follower, _activity} = CommonAPI.follow(following, follower)
result =
StreamerView.render(