diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-09-15 20:29:39 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-09-15 20:29:39 +0300 |
commit | 2f155fb89f7175ac95e188bfd8896848d5332d18 (patch) | |
tree | 5f04268d0189b6961c53904b027846cbe4281ae5 /test/web | |
parent | cd234a5321b9d33146b90be95d84fa67aa4f7707 (diff) | |
parent | cfad4f46b2d53f67722f7b8046b673d60a9cefcd (diff) | |
download | pleroma-2f155fb89f7175ac95e188bfd8896848d5332d18.tar.gz pleroma-2f155fb89f7175ac95e188bfd8896848d5332d18.zip |
Merge remote-tracking branch 'remotes/origin/develop' into media-preview-proxy-nostream
Diffstat (limited to 'test/web')
-rw-r--r-- | test/web/activity_pub/activity_pub_test.exs | 8 | ||||
-rw-r--r-- | test/web/rich_media/parser_test.exs | 29 |
2 files changed, 37 insertions, 0 deletions
diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index d8caa0b00..7bdad3810 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -1810,6 +1810,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do |> Enum.map(& &1.id) assert activities_ids == [] + + activities_ids = + %{} + |> Map.put(:reply_visibility, "self") + |> Map.put(:reply_filtering_user, nil) + |> ActivityPub.fetch_public_activities() + + assert activities_ids == [] end test "home timeline", %{users: %{u1: user}} do diff --git a/test/web/rich_media/parser_test.exs b/test/web/rich_media/parser_test.exs index 21ae35f8b..6d00c2af5 100644 --- a/test/web/rich_media/parser_test.exs +++ b/test/web/rich_media/parser_test.exs @@ -56,6 +56,27 @@ defmodule Pleroma.Web.RichMedia.ParserTest do %{method: :get, url: "http://example.com/error"} -> {:error, :overload} + + %{ + method: :head, + url: "http://example.com/huge-page" + } -> + %Tesla.Env{ + status: 200, + headers: [{"content-length", "2000001"}, {"content-type", "text/html"}] + } + + %{ + method: :head, + url: "http://example.com/pdf-file" + } -> + %Tesla.Env{ + status: 200, + headers: [{"content-length", "1000000"}, {"content-type", "application/pdf"}] + } + + %{method: :head} -> + %Tesla.Env{status: 404, body: "", headers: []} end) :ok @@ -144,4 +165,12 @@ defmodule Pleroma.Web.RichMedia.ParserTest do test "returns error if getting page was not successful" do assert {:error, :overload} = Parser.parse("http://example.com/error") end + + test "does a HEAD request to check if the body is too large" do + assert {:error, :body_too_large} = Parser.parse("http://example.com/huge-page") + end + + test "does a HEAD request to check if the body is html" do + assert {:error, {:content_type, _}} = Parser.parse("http://example.com/pdf-file") + end end |