summaryrefslogtreecommitdiff
path: root/test/web/common_api/common_api_utils_test.exs
diff options
context:
space:
mode:
authorRoman Chvanikov <chvanikoff@pm.me>2019-08-02 18:16:04 +0300
committerRoman Chvanikov <chvanikoff@pm.me>2019-08-02 18:16:04 +0300
commit9d4f34fbcb1a8e2eca424b3a3374c9f9af972574 (patch)
treec5943eb5d2652e08cc12d0b58a992376c425e66d /test/web/common_api/common_api_utils_test.exs
parentd2da3d30f3349946500423bab53e0c1221ab7b9b (diff)
parent5ff8f07ca906d77a6ec1d5ba912a787f855364f9 (diff)
downloadpleroma-9d4f34fbcb1a8e2eca424b3a3374c9f9af972574.tar.gz
pleroma-9d4f34fbcb1a8e2eca424b3a3374c9f9af972574.zip
Merge branch 'develop' into feature/digest-email
Diffstat (limited to 'test/web/common_api/common_api_utils_test.exs')
-rw-r--r--test/web/common_api/common_api_utils_test.exs20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_utils_test.exs b/test/web/common_api/common_api_utils_test.exs
index af320f31f..4b5666c29 100644
--- a/test/web/common_api/common_api_utils_test.exs
+++ b/test/web/common_api/common_api_utils_test.exs
@@ -360,4 +360,24 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do
assert third_user.ap_id in to
end
end
+
+ describe "get_by_id_or_ap_id/1" do
+ test "get activity by id" do
+ activity = insert(:note_activity)
+ %Pleroma.Activity{} = note = Utils.get_by_id_or_ap_id(activity.id)
+ assert note.id == activity.id
+ end
+
+ test "get activity by ap_id" do
+ activity = insert(:note_activity)
+ %Pleroma.Activity{} = note = Utils.get_by_id_or_ap_id(activity.data["object"])
+ assert note.id == activity.id
+ end
+
+ test "get activity by object when type isn't `Create` " do
+ activity = insert(:like_activity)
+ %Pleroma.Activity{} = like = Utils.get_by_id_or_ap_id(activity.id)
+ assert like.data["object"] == activity.data["object"]
+ end
+ end
end