maintenance: dependency upgrade (#81)
[akkoma] / test / pleroma / web / common_api_test.exs
index 4a10a5bc488e651ffbe2b1deb683f5fb9e62a02d..85a4a3a1139afdcd9bcc64420611d8e1b6dcad6c 100644 (file)
@@ -27,6 +27,8 @@ defmodule Pleroma.Web.CommonAPITest do
   require Pleroma.Constants
 
   setup_all do
+    clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
+    clear_config([Pleroma.Uploaders.Local, :uploads], "uploads")
     Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
     :ok
   end
@@ -209,9 +211,7 @@ defmodule Pleroma.Web.CommonAPITest do
       object = Object.normalize(activity, fetch: false)
 
       assert object.data["content"] ==
-               "<a href=\"https://example.org\" rel=\"ugc\">https://example.org</a> is the site of <span class=\"h-card\"><a class=\"u-url mention\" data-user=\"#{
-                 other_user.id
-               }\" href=\"#{other_user.ap_id}\" rel=\"ugc\">@<span>#{other_user.nickname}</span></a></span> <a class=\"hashtag\" data-tag=\"2hu\" href=\"http://localhost:4001/tag/2hu\">#2hu</a>"
+               "<a href=\"https://example.org\" rel=\"ugc\">https://example.org</a> is the site of <span class=\"h-card\"><a class=\"u-url mention\" data-user=\"#{other_user.id}\" href=\"#{other_user.ap_id}\" rel=\"ugc\">@<span>#{other_user.nickname}</span></a></span> <a class=\"hashtag\" data-tag=\"2hu\" href=\"http://localhost:4001/tag/2hu\">#2hu</a>"
     end
 
     test "it posts a chat message" do
@@ -588,7 +588,11 @@ defmodule Pleroma.Web.CommonAPITest do
       object = Object.normalize(activity, fetch: false)
 
       assert object.data["content"] == "<p><b>2hu</b></p>alert(&#39;xss&#39;)"
-      assert object.data["source"] == post
+
+      assert object.data["source"] == %{
+               "mediaType" => "text/html",
+               "content" => post
+             }
     end
 
     test "it filters out obviously bad tags when accepting a post as Markdown" do
@@ -605,7 +609,11 @@ defmodule Pleroma.Web.CommonAPITest do
       object = Object.normalize(activity, fetch: false)
 
       assert object.data["content"] == "<p><b>2hu</b></p>"
-      assert object.data["source"] == post
+
+      assert object.data["source"] == %{
+               "mediaType" => "text/markdown",
+               "content" => post
+             }
     end
 
     test "it does not allow replies to direct messages that are not direct messages themselves" do