diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/activity_pub/builder_test.exs | 46 | ||||
-rw-r--r-- | test/pleroma/web/common_api/utils_test.exs | 35 |
2 files changed, 46 insertions, 35 deletions
diff --git a/test/pleroma/web/activity_pub/builder_test.exs b/test/pleroma/web/activity_pub/builder_test.exs new file mode 100644 index 000000000..103521c96 --- /dev/null +++ b/test/pleroma/web/activity_pub/builder_test.exs @@ -0,0 +1,46 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ActivityPub.BuilderTest do + alias Pleroma.Web.ActivityPub.Builder + alias Pleroma.Web.CommonAPI.ActivityDraft + use Pleroma.DataCase + + import Pleroma.Factory + + describe "note/1" do + test "returns note data" do + user = insert(:user) + note = insert(:note) + user2 = insert(:user) + user3 = insert(:user) + + draft = %ActivityDraft{ + user: user, + to: [user2.ap_id], + context: "2hu", + content_html: "<h1>This is :moominmamma: note</h1>", + in_reply_to: note.id, + tags: [name: "jimm"], + summary: "test summary", + cc: [user3.ap_id], + extra: %{"custom_tag" => "test"} + } + + assert Builder.note(draft) == %{ + "actor" => user.ap_id, + "attachment" => [], + "cc" => [user3.ap_id], + "content" => "<h1>This is :moominmamma: note</h1>", + "context" => "2hu", + "sensitive" => false, + "summary" => "test summary", + "tag" => ["jimm"], + "to" => [user2.ap_id], + "type" => "Note", + "custom_tag" => "test" + } + end + end +end diff --git a/test/pleroma/web/common_api/utils_test.exs b/test/pleroma/web/common_api/utils_test.exs index b0e567ff0..d8fec3520 100644 --- a/test/pleroma/web/common_api/utils_test.exs +++ b/test/pleroma/web/common_api/utils_test.exs @@ -681,41 +681,6 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do end end - describe "make_note_data/1" do - test "returns note data" do - user = insert(:user) - note = insert(:note) - user2 = insert(:user) - user3 = insert(:user) - - draft = %ActivityDraft{ - user: user, - to: [user2.ap_id], - context: "2hu", - content_html: "<h1>This is :moominmamma: note</h1>", - in_reply_to: note.id, - tags: [name: "jimm"], - summary: "test summary", - cc: [user3.ap_id], - extra: %{"custom_tag" => "test"} - } - - assert Utils.make_note_data(draft) == %{ - "actor" => user.ap_id, - "attachment" => [], - "cc" => [user3.ap_id], - "content" => "<h1>This is :moominmamma: note</h1>", - "context" => "2hu", - "sensitive" => false, - "summary" => "test summary", - "tag" => ["jimm"], - "to" => [user2.ap_id], - "type" => "Note", - "custom_tag" => "test" - } - end - end - describe "maybe_add_attachments/3" do test "returns parsed results when attachment_links is false" do assert Utils.maybe_add_attachments( |