aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2019-09-13 14:48:00 +0000
committerlain <lain@soykaf.club>2019-09-13 14:48:00 +0000
commit53a3ad60435d4f7eab2dbf1235e5974bac275aa0 (patch)
treeb8f3c2196e1e0b7aefeb6a1a889b17b72c972e91 /test
parent0d9609894f4f4557da2db62a33da1b8995c9e1d7 (diff)
parent5bfbad13ad4dd009b172748d81f56ead21c700de (diff)
downloadpleroma-53a3ad60435d4f7eab2dbf1235e5974bac275aa0.tar.gz
Merge branch 'cleanup-activity' into 'develop'
Cleanup `Pleroma.Activity` and add more tests See merge request pleroma/pleroma!1623
Diffstat (limited to 'test')
-rw-r--r--test/activity_test.exs31
-rw-r--r--test/user_test.exs2
2 files changed, 32 insertions, 1 deletions
diff --git a/test/activity_test.exs b/test/activity_test.exs
index 4152aaa7e..f9f789a76 100644
--- a/test/activity_test.exs
+++ b/test/activity_test.exs
@@ -185,4 +185,35 @@ defmodule Pleroma.ActivityTest do
assert [%{id: ^id1, object: %Object{}}, %{id: ^id2, object: %Object{}}] = activities
end
+
+ test "get_by_id_with_object/1" do
+ %{id: id} = insert(:note_activity)
+
+ assert %Activity{id: ^id, object: %Object{}} = Activity.get_by_id_with_object(id)
+ end
+
+ test "get_by_ap_id_with_object/1" do
+ %{data: %{"id" => ap_id}} = insert(:note_activity)
+
+ assert %Activity{data: %{"id" => ^ap_id}, object: %Object{}} =
+ Activity.get_by_ap_id_with_object(ap_id)
+ end
+
+ test "get_by_id/1" do
+ %{id: id} = insert(:note_activity)
+
+ assert %Activity{id: ^id} = Activity.get_by_id(id)
+ end
+
+ test "all_by_actor_and_id/2" do
+ user = insert(:user)
+
+ {:ok, %{id: id1}} = Pleroma.Web.CommonAPI.post(user, %{"status" => "cofe"})
+ {:ok, %{id: id2}} = Pleroma.Web.CommonAPI.post(user, %{"status" => "cofefe"})
+
+ assert [] == Activity.all_by_actor_and_id(user, [])
+
+ assert [%Activity{id: ^id2}, %Activity{id: ^id1}] =
+ Activity.all_by_actor_and_id(user.ap_id, [id1, id2])
+ end
end
diff --git a/test/user_test.exs b/test/user_test.exs
index ed8cdbe31..05b158025 100644
--- a/test/user_test.exs
+++ b/test/user_test.exs
@@ -1081,7 +1081,7 @@ defmodule Pleroma.UserTest do
user_activities =
user.ap_id
- |> Activity.query_by_actor()
+ |> Activity.Queries.by_actor()
|> Repo.all()
|> Enum.map(fn act -> act.data["type"] end)