diff options
Diffstat (limited to 'test/web/mastodon_api')
| -rw-r--r-- | test/web/mastodon_api/views/account_view_test.exs | 38 | 
1 files changed, 22 insertions, 16 deletions
diff --git a/test/web/mastodon_api/views/account_view_test.exs b/test/web/mastodon_api/views/account_view_test.exs index 9f22f9dcf..793b44fca 100644 --- a/test/web/mastodon_api/views/account_view_test.exs +++ b/test/web/mastodon_api/views/account_view_test.exs @@ -5,6 +5,7 @@  defmodule Pleroma.Web.MastodonAPI.AccountViewTest do    use Pleroma.DataCase +  alias Pleroma.Config    alias Pleroma.User    alias Pleroma.UserRelationship    alias Pleroma.Web.CommonAPI @@ -540,8 +541,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do      end    end -  test "uses mediaproxy urls when it's enabled" do +  test "uses mediaproxy urls when it's enabled (regardless of media preview proxy state)" do      clear_config([:media_proxy, :enabled], true) +    clear_config([:media_preview_proxy, :enabled])      user =        insert(:user, @@ -550,20 +552,24 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do          emoji: %{"joker_smile" => "https://evil.website/society.png"}        ) -    AccountView.render("show.json", %{user: user, skip_visibility_check: true}) -    |> Enum.all?(fn -      {key, url} when key in [:avatar, :avatar_static, :header, :header_static] -> -        String.starts_with?(url, Pleroma.Web.base_url()) - -      {:emojis, emojis} -> -        Enum.all?(emojis, fn %{url: url, static_url: static_url} -> -          String.starts_with?(url, Pleroma.Web.base_url()) && -            String.starts_with?(static_url, Pleroma.Web.base_url()) -        end) - -      _ -> -        true -    end) -    |> assert() +    with media_preview_enabled <- [false, true] do +      Config.put([:media_preview_proxy, :enabled], media_preview_enabled) + +      AccountView.render("show.json", %{user: user, skip_visibility_check: true}) +      |> Enum.all?(fn +        {key, url} when key in [:avatar, :avatar_static, :header, :header_static] -> +          String.starts_with?(url, Pleroma.Web.base_url()) + +        {:emojis, emojis} -> +          Enum.all?(emojis, fn %{url: url, static_url: static_url} -> +            String.starts_with?(url, Pleroma.Web.base_url()) && +              String.starts_with?(static_url, Pleroma.Web.base_url()) +          end) + +        _ -> +          true +      end) +      |> assert() +    end    end  end  | 
