diff options
| author | lain <lain@soykaf.club> | 2020-05-03 12:55:29 +0200 |
|---|---|---|
| committer | lain <lain@soykaf.club> | 2020-05-03 12:55:29 +0200 |
| commit | 6fb96f64c13597bcf8d10f30442ac61610cec58e (patch) | |
| tree | 29db6b5d77a562dd496618ebcd54c15574f093a8 /test/web/activity_pub/transmogrifier_test.exs | |
| parent | 4dfc617cdf1c2579f4f941dcd0fa5c728178df06 (diff) | |
| parent | 095635453ac58b9e01a32ad226c0b61466c16da0 (diff) | |
| download | pleroma-6fb96f64c13597bcf8d10f30442ac61610cec58e.tar.gz pleroma-6fb96f64c13597bcf8d10f30442ac61610cec58e.zip | |
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into feature/delete-validator
Diffstat (limited to 'test/web/activity_pub/transmogrifier_test.exs')
| -rw-r--r-- | test/web/activity_pub/transmogrifier_test.exs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index 64e56d378..4a28c6314 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -1144,6 +1144,35 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do :error = Transmogrifier.handle_incoming(data) end + test "skip converting the content when it is nil" do + object_id = "https://peertube.social/videos/watch/278d2b7c-0f38-4aaa-afe6-9ecc0c4a34fe" + + {:ok, object} = Fetcher.fetch_and_contain_remote_object_from_id(object_id) + + result = + Pleroma.Web.ActivityPub.Transmogrifier.fix_object(Map.merge(object, %{"content" => nil})) + + assert result["content"] == nil + end + + test "it converts content of object to html" do + object_id = "https://peertube.social/videos/watch/278d2b7c-0f38-4aaa-afe6-9ecc0c4a34fe" + + {:ok, %{"content" => content_markdown}} = + Fetcher.fetch_and_contain_remote_object_from_id(object_id) + + {:ok, %Pleroma.Object{data: %{"content" => content}} = object} = + Fetcher.fetch_object_from_id(object_id) + + assert content_markdown == + "Support this and our other Michigan!/usr/group videos and meetings. Learn more at http://mug.org/membership\n\nTwenty Years in Jail: FreeBSD's Jails, Then and Now\n\nJails started as a limited virtualization system, but over the last two years they've..." + + assert content == + "<p>Support this and our other Michigan!/usr/group videos and meetings. Learn more at <a href=\"http://mug.org/membership\">http://mug.org/membership</a></p><p>Twenty Years in Jail: FreeBSD’s Jails, Then and Now</p><p>Jails started as a limited virtualization system, but over the last two years they’ve…</p>" + + assert object.data["mediaType"] == "text/html" + end + test "it remaps video URLs as attachments if necessary" do {:ok, object} = Fetcher.fetch_object_from_id( |
