aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/notification_test.exs2
-rw-r--r--test/web/activity_pub/activity_pub_test.exs71
-rw-r--r--test/web/activity_pub/transmogrifier_test.exs4
-rw-r--r--test/web/common_api/common_api_test.exs4
-rw-r--r--test/web/mastodon_api/views/notification_view_test.exs2
-rw-r--r--test/web/mastodon_api/views/status_view_test.exs6
-rw-r--r--test/web/pleroma_api/controllers/pleroma_api_controller_test.exs10
7 files changed, 17 insertions, 82 deletions
diff --git a/test/notification_test.exs b/test/notification_test.exs
index 601a6c0ca..bd562c85c 100644
--- a/test/notification_test.exs
+++ b/test/notification_test.exs
@@ -24,7 +24,7 @@ defmodule Pleroma.NotificationTest do
other_user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{"status" => "yeah"})
- {:ok, activity, _object} = CommonAPI.react_with_emoji(activity.id, other_user, "☕")
+ {:ok, activity} = CommonAPI.react_with_emoji(activity.id, other_user, "☕")
{:ok, [notification]} = Notification.create_notifications(activity)
diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs
index 84ead93bb..1ac4f9896 100644
--- a/test/web/activity_pub/activity_pub_test.exs
+++ b/test/web/activity_pub/activity_pub_test.exs
@@ -874,71 +874,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
end
end
- describe "react to an object" do
- test_with_mock "sends an activity to federation", Federator, [:passthrough], [] do
- Config.put([:instance, :federating], true)
- user = insert(:user)
- reactor = insert(:user)
- {:ok, activity} = CommonAPI.post(user, %{"status" => "YASSSS queen slay"})
- assert object = Object.normalize(activity)
-
- {:ok, reaction_activity, _object} = ActivityPub.react_with_emoji(reactor, object, "🔥")
-
- assert called(Federator.publish(reaction_activity))
- end
-
- test "adds an emoji reaction activity to the db" do
- user = insert(:user)
- reactor = insert(:user)
- third_user = insert(:user)
- fourth_user = insert(:user)
- {:ok, activity} = CommonAPI.post(user, %{"status" => "YASSSS queen slay"})
- assert object = Object.normalize(activity)
-
- {:ok, reaction_activity, object} = ActivityPub.react_with_emoji(reactor, object, "🔥")
-
- assert reaction_activity
-
- assert reaction_activity.data["actor"] == reactor.ap_id
- assert reaction_activity.data["type"] == "EmojiReact"
- assert reaction_activity.data["content"] == "🔥"
- assert reaction_activity.data["object"] == object.data["id"]
- assert reaction_activity.data["to"] == [User.ap_followers(reactor), activity.data["actor"]]
- assert reaction_activity.data["context"] == object.data["context"]
- assert object.data["reaction_count"] == 1
- assert object.data["reactions"] == [["🔥", [reactor.ap_id]]]
-
- {:ok, _reaction_activity, object} = ActivityPub.react_with_emoji(third_user, object, "☕")
-
- assert object.data["reaction_count"] == 2
- assert object.data["reactions"] == [["🔥", [reactor.ap_id]], ["☕", [third_user.ap_id]]]
-
- {:ok, _reaction_activity, object} = ActivityPub.react_with_emoji(fourth_user, object, "🔥")
-
- assert object.data["reaction_count"] == 3
-
- assert object.data["reactions"] == [
- ["🔥", [fourth_user.ap_id, reactor.ap_id]],
- ["☕", [third_user.ap_id]]
- ]
- end
-
- test "reverts emoji reaction on error" do
- [user, reactor] = insert_list(2, :user)
-
- {:ok, activity} = CommonAPI.post(user, %{"status" => "Status"})
- object = Object.normalize(activity)
-
- with_mock(Utils, [:passthrough], maybe_federate: fn _ -> {:error, :reverted} end) do
- assert {:error, :reverted} = ActivityPub.react_with_emoji(reactor, object, "😀")
- end
-
- object = Object.get_by_ap_id(object.data["id"])
- refute object.data["reaction_count"]
- refute object.data["reactions"]
- end
- end
-
describe "unreacting to an object" do
test_with_mock "sends an activity to federation", Federator, [:passthrough], [] do
Config.put([:instance, :federating], true)
@@ -947,7 +882,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
{:ok, activity} = CommonAPI.post(user, %{"status" => "YASSSS queen slay"})
assert object = Object.normalize(activity)
- {:ok, reaction_activity, _object} = ActivityPub.react_with_emoji(reactor, object, "🔥")
+ {:ok, reaction_activity} = CommonAPI.react_with_emoji(activity.id, reactor, "🔥")
assert called(Federator.publish(reaction_activity))
@@ -963,7 +898,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
{:ok, activity} = CommonAPI.post(user, %{"status" => "YASSSS queen slay"})
assert object = Object.normalize(activity)
- {:ok, reaction_activity, _object} = ActivityPub.react_with_emoji(reactor, object, "🔥")
+ {:ok, reaction_activity} = CommonAPI.react_with_emoji(activity.id, reactor, "🔥")
{:ok, unreaction_activity, _object} =
ActivityPub.unreact_with_emoji(reactor, reaction_activity.data["id"])
@@ -981,7 +916,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
{:ok, activity} = CommonAPI.post(user, %{"status" => "Status"})
object = Object.normalize(activity)
- {:ok, reaction_activity, _object} = ActivityPub.react_with_emoji(reactor, object, "😀")
+ {:ok, reaction_activity} = CommonAPI.react_with_emoji(activity.id, reactor, "😀")
with_mock(Utils, [:passthrough], maybe_federate: fn _ -> {:error, :reverted} end) do
assert {:error, :reverted} =
diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs
index c1c3ff9d2..7deac2909 100644
--- a/test/web/activity_pub/transmogrifier_test.exs
+++ b/test/web/activity_pub/transmogrifier_test.exs
@@ -329,7 +329,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{"status" => "hello"})
- {:ok, reaction_activity, _object} = CommonAPI.react_with_emoji(activity.id, user, "👌")
+ {:ok, reaction_activity} = CommonAPI.react_with_emoji(activity.id, user, "👌")
data =
File.read!("test/fixtures/mastodon-undo-like.json")
@@ -562,7 +562,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
test "it strips internal reactions" do
user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{"status" => "#cofe"})
- {:ok, _, _} = CommonAPI.react_with_emoji(activity.id, user, "📢")
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, user, "📢")
%{object: object} = Activity.get_by_id_with_object(activity.id)
assert Map.has_key?(object.data, "reactions")
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs
index bc0c1a791..74171fcd9 100644
--- a/test/web/common_api/common_api_test.exs
+++ b/test/web/common_api/common_api_test.exs
@@ -278,7 +278,7 @@ defmodule Pleroma.Web.CommonAPITest do
{:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
- {:ok, reaction, _} = CommonAPI.react_with_emoji(activity.id, user, "👍")
+ {:ok, reaction} = CommonAPI.react_with_emoji(activity.id, user, "👍")
assert reaction.data["actor"] == user.ap_id
assert reaction.data["content"] == "👍"
@@ -293,7 +293,7 @@ defmodule Pleroma.Web.CommonAPITest do
other_user = insert(:user)
{:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
- {:ok, reaction, _} = CommonAPI.react_with_emoji(activity.id, user, "👍")
+ {:ok, reaction} = CommonAPI.react_with_emoji(activity.id, user, "👍")
{:ok, unreaction, _} = CommonAPI.unreact_with_emoji(activity.id, user, "👍")
diff --git a/test/web/mastodon_api/views/notification_view_test.exs b/test/web/mastodon_api/views/notification_view_test.exs
index c3ec9dfec..0806269a2 100644
--- a/test/web/mastodon_api/views/notification_view_test.exs
+++ b/test/web/mastodon_api/views/notification_view_test.exs
@@ -156,7 +156,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do
other_user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{"status" => "#cofe"})
- {:ok, _activity, _} = CommonAPI.react_with_emoji(activity.id, other_user, "☕")
+ {:ok, _activity} = CommonAPI.react_with_emoji(activity.id, other_user, "☕")
activity = Repo.get(Activity, activity.id)
diff --git a/test/web/mastodon_api/views/status_view_test.exs b/test/web/mastodon_api/views/status_view_test.exs
index 6791c2fb0..b64370c3f 100644
--- a/test/web/mastodon_api/views/status_view_test.exs
+++ b/test/web/mastodon_api/views/status_view_test.exs
@@ -32,9 +32,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
third_user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{"status" => "dae cofe??"})
- {:ok, _, _} = CommonAPI.react_with_emoji(activity.id, user, "☕")
- {:ok, _, _} = CommonAPI.react_with_emoji(activity.id, third_user, "🍵")
- {:ok, _, _} = CommonAPI.react_with_emoji(activity.id, other_user, "☕")
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, user, "☕")
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, third_user, "🍵")
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, other_user, "☕")
activity = Repo.get(Activity, activity.id)
status = StatusView.render("show.json", activity: activity)
diff --git a/test/web/pleroma_api/controllers/pleroma_api_controller_test.exs b/test/web/pleroma_api/controllers/pleroma_api_controller_test.exs
index 61a1689b9..593aa92b2 100644
--- a/test/web/pleroma_api/controllers/pleroma_api_controller_test.exs
+++ b/test/web/pleroma_api/controllers/pleroma_api_controller_test.exs
@@ -41,7 +41,7 @@ defmodule Pleroma.Web.PleromaAPI.PleromaAPIControllerTest do
other_user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{"status" => "#cofe"})
- {:ok, activity, _object} = CommonAPI.react_with_emoji(activity.id, other_user, "☕")
+ {:ok, activity} = CommonAPI.react_with_emoji(activity.id, other_user, "☕")
result =
conn
@@ -71,8 +71,8 @@ defmodule Pleroma.Web.PleromaAPI.PleromaAPIControllerTest do
assert result == []
- {:ok, _, _} = CommonAPI.react_with_emoji(activity.id, other_user, "🎅")
- {:ok, _, _} = CommonAPI.react_with_emoji(activity.id, doomed_user, "🎅")
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, other_user, "🎅")
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, doomed_user, "🎅")
User.perform(:delete, doomed_user)
@@ -109,8 +109,8 @@ defmodule Pleroma.Web.PleromaAPI.PleromaAPIControllerTest do
assert result == []
- {:ok, _, _} = CommonAPI.react_with_emoji(activity.id, other_user, "🎅")
- {:ok, _, _} = CommonAPI.react_with_emoji(activity.id, other_user, "☕")
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, other_user, "🎅")
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, other_user, "☕")
result =
conn