aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2018-12-23 13:28:17 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2018-12-23 13:31:08 +0000
commit71f6d9f418087a16ff266ef380b3290088e0d301 (patch)
treee6f176d73f1caf959b0049531a10340370a108b6 /test
parent3aff8067e4b65962fe65812807cbb52bd971ddd8 (diff)
downloadpleroma-71f6d9f418087a16ff266ef380b3290088e0d301.tar.gz
transmogrifier: significantly rework handling of peertube videos, add test
Diffstat (limited to 'test')
-rw-r--r--test/web/activity_pub/transmogrifier_test.exs30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs
index 0428e052d..6778db390 100644
--- a/test/web/activity_pub/transmogrifier_test.exs
+++ b/test/web/activity_pub/transmogrifier_test.exs
@@ -684,6 +684,36 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
:error = Transmogrifier.handle_incoming(data)
end
+
+ test "it remaps video URLs as attachments if necessary" do
+ {:ok, object} =
+ ActivityPub.fetch_object_from_id(
+ "https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3"
+ )
+
+ attachment = %{
+ "type" => "Link",
+ "mediaType" => "video/mp4",
+ "href" =>
+ "https://peertube.moe/static/webseed/df5f464b-be8d-46fb-ad81-2d4c2d1630e3-480.mp4",
+ "mimeType" => "video/mp4",
+ "size" => 5_015_880,
+ "url" => [
+ %{
+ "href" =>
+ "https://peertube.moe/static/webseed/df5f464b-be8d-46fb-ad81-2d4c2d1630e3-480.mp4",
+ "mediaType" => "video/mp4",
+ "type" => "Link"
+ }
+ ],
+ "width" => 480
+ }
+
+ assert object.data["url"] ==
+ "https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3"
+
+ assert object.data["attachment"] == [attachment]
+ end
end
describe "prepare outgoing" do