diff options
author | tusooa <tusooa@kazv.moe> | 2023-07-18 18:39:59 -0400 |
---|---|---|
committer | tusooa <tusooa@kazv.moe> | 2023-07-18 18:39:59 -0400 |
commit | ea4225a646b355150fb8e5e8c77d7fdc58b5e7ef (patch) | |
tree | d6d16c00a64cb2bd611d0aa25622963f5d192cc2 /test | |
parent | 93ad16cca0a5b6acc1308027f798e347f44de4f8 (diff) | |
download | pleroma-ea4225a646b355150fb8e5e8c77d7fdc58b5e7ef.tar.gz pleroma-ea4225a646b355150fb8e5e8c77d7fdc58b5e7ef.zip |
Restrict attachments to only uploaded files only
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/common_api/utils_test.exs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/pleroma/web/common_api/utils_test.exs b/test/pleroma/web/common_api/utils_test.exs index d309c6ded..ca5b92683 100644 --- a/test/pleroma/web/common_api/utils_test.exs +++ b/test/pleroma/web/common_api/utils_test.exs @@ -592,7 +592,7 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do end test "returns list attachments with desc" do - object = insert(:note) + object = insert(:attachment) desc = Jason.encode!(%{object.id => "test-desc"}) assert Utils.attachments_from_ids_descs(["#{object.id}", "34"], desc) == [ @@ -603,7 +603,7 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do describe "attachments_from_ids/1" do test "returns attachments with descs" do - object = insert(:note) + object = insert(:attachment) desc = Jason.encode!(%{object.id => "test-desc"}) assert Utils.attachments_from_ids(%{ @@ -615,13 +615,18 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do end test "returns attachments without descs" do - object = insert(:note) + object = insert(:attachment) assert Utils.attachments_from_ids(%{media_ids: ["#{object.id}"]}) == [object.data] end test "returns [] when not pass media_ids" do assert Utils.attachments_from_ids(%{}) == [] end + + test "checks that the object is of upload type" do + object = insert(:note) + assert Utils.attachments_from_ids(%{media_ids: ["#{object.id}"]}) == [] + end end describe "maybe_add_list_data/3" do |