diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-04-02 15:41:30 +0700 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-04-02 15:41:30 +0700 |
commit | a1869f5272ddd83cdf2b2fc487668de79f2d0c6d (patch) | |
tree | def42bef14e8ced310471a194080e38cbee15452 /test/web/common_api/common_api_utils_test.exs | |
parent | 16e598ec11cb9178b9fc53a1ec4b649d97c5f3b8 (diff) | |
parent | f8aa917eef9280631a5cd2c95cf1db8fab6e14e5 (diff) | |
download | pleroma-a1869f5272ddd83cdf2b2fc487668de79f2d0c6d.tar.gz pleroma-a1869f5272ddd83cdf2b2fc487668de79f2d0c6d.zip |
Merge remote-tracking branch 'pleroma/develop' into remove-user-activities
Diffstat (limited to 'test/web/common_api/common_api_utils_test.exs')
-rw-r--r-- | test/web/common_api/common_api_utils_test.exs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/web/common_api/common_api_utils_test.exs b/test/web/common_api/common_api_utils_test.exs index 684f2a23f..e04b9f9b5 100644 --- a/test/web/common_api/common_api_utils_test.exs +++ b/test/web/common_api/common_api_utils_test.exs @@ -3,9 +3,10 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.CommonAPI.UtilsTest do + alias Pleroma.Builders.UserBuilder + alias Pleroma.Object alias Pleroma.Web.CommonAPI.Utils alias Pleroma.Web.Endpoint - alias Pleroma.Builders.UserBuilder use Pleroma.DataCase test "it adds attachment links to a given text and attachment set" do @@ -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 |