summaryrefslogtreecommitdiff
path: root/test/web/common_api/common_api_utils_test.exs
diff options
context:
space:
mode:
authorkaniini <nenolod@gmail.com>2019-03-22 00:25:35 +0000
committerkaniini <nenolod@gmail.com>2019-03-22 00:25:35 +0000
commitb548181b52c4397d5034cfd95b2ef7e05c9c9c22 (patch)
treea847bb70d52da43b2f0cca45f7ea49cb4e664c5a /test/web/common_api/common_api_utils_test.exs
parentbf8b29e080a6a8a369abb53a26229bb0544de1c0 (diff)
parenta223e65f35da158ef79f05f65316920dcecaa54b (diff)
downloadpleroma-b548181b52c4397d5034cfd95b2ef7e05c9c9c22.tar.gz
pleroma-b548181b52c4397d5034cfd95b2ef7e05c9c9c22.zip
Merge branch 'feature/mastoapi-ext-conversation-id' into 'develop'
Mastodon API: add conversation_id extension See merge request pleroma/pleroma!961
Diffstat (limited to 'test/web/common_api/common_api_utils_test.exs')
-rw-r--r--test/web/common_api/common_api_utils_test.exs17
1 files changed, 17 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 4c97b0d62..e04b9f9b5 100644
--- a/test/web/common_api/common_api_utils_test.exs
+++ b/test/web/common_api/common_api_utils_test.exs
@@ -4,6 +4,7 @@
defmodule Pleroma.Web.CommonAPI.UtilsTest do
alias Pleroma.Builders.UserBuilder
+ alias Pleroma.Object
alias Pleroma.Web.CommonAPI.Utils
alias Pleroma.Web.Endpoint
use Pleroma.DataCase
@@ -136,4 +137,20 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do
assert output == expected
end
end
+
+ describe "context_to_conversation_id" do
+ test "creates a mapping object" do
+ conversation_id = Utils.context_to_conversation_id("random context")
+ object = Object.get_by_ap_id("random context")
+
+ assert conversation_id == object.id
+ end
+
+ test "returns an existing mapping for an existing object" do
+ {:ok, object} = Object.context_mapping("random context") |> Repo.insert()
+ conversation_id = Utils.context_to_conversation_id("random context")
+
+ assert conversation_id == object.id
+ end
+ end
end