1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicyTest do
9 alias Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy
17 "content" => "content",
19 %{"url" => [%{"href" => "http://example.com/image.jpg"}]}
24 test "it prefetches media proxy URIs" do
25 with_mock HTTP, get: fn _, _, _ -> {:ok, []} end do
26 MediaProxyWarmingPolicy.filter(@message)
27 assert called(HTTP.get(:_, :_, :_))
31 test "it does nothing when no attachments are present" do
34 |> Map.delete("attachment")
38 |> Map.put("object", object)
40 with_mock HTTP, get: fn _, _, _ -> {:ok, []} end do
41 MediaProxyWarmingPolicy.filter(message)
42 refute called(HTTP.get(:_, :_, :_))