MastodonAPI.AccountViewTest: Fix tests

This commit is contained in:
Lain Soykaf 2023-12-11 10:33:33 +04:00
parent 50c31cb31b
commit e8e74146e8
1 changed files with 7 additions and 2 deletions

View File

@ -5,11 +5,13 @@
defmodule Pleroma.Web.MastodonAPI.AccountViewTest do defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
use Pleroma.DataCase, async: false use Pleroma.DataCase, async: false
alias Pleroma.UnstubbedConfigMock, as: ConfigMock
alias Pleroma.User alias Pleroma.User
alias Pleroma.UserRelationship alias Pleroma.UserRelationship
alias Pleroma.Web.CommonAPI alias Pleroma.Web.CommonAPI
alias Pleroma.Web.MastodonAPI.AccountView alias Pleroma.Web.MastodonAPI.AccountView
import Mox
import Pleroma.Factory import Pleroma.Factory
import Tesla.Mock import Tesla.Mock
@ -753,6 +755,9 @@ test "uses mediaproxy urls when it's enabled (regardless of media preview proxy
clear_config([:media_proxy, :enabled], true) clear_config([:media_proxy, :enabled], true)
clear_config([:media_preview_proxy, :enabled]) clear_config([:media_preview_proxy, :enabled])
ConfigMock
|> stub_with(Pleroma.Test.StaticConfig)
user = user =
insert(:user, insert(:user,
avatar: %{"url" => [%{"href" => "https://evil.website/avatar.png"}]}, avatar: %{"url" => [%{"href" => "https://evil.website/avatar.png"}]},
@ -760,7 +765,7 @@ test "uses mediaproxy urls when it's enabled (regardless of media preview proxy
emoji: %{"joker_smile" => "https://evil.website/society.png"} emoji: %{"joker_smile" => "https://evil.website/society.png"}
) )
with media_preview_enabled <- [false, true] do Enum.each([true, false], fn media_preview_enabled ->
clear_config([:media_preview_proxy, :enabled], media_preview_enabled) clear_config([:media_preview_proxy, :enabled], media_preview_enabled)
AccountView.render("show.json", %{user: user, skip_visibility_check: true}) AccountView.render("show.json", %{user: user, skip_visibility_check: true})
@ -778,7 +783,7 @@ test "uses mediaproxy urls when it's enabled (regardless of media preview proxy
true true
end) end)
|> assert() |> assert()
end end)
end end
test "renders mute expiration date" do test "renders mute expiration date" do