aboutsummaryrefslogtreecommitdiff
path: root/test/pleroma/web/mastodon_api/views/account_view_test.exs
diff options
context:
space:
mode:
authordcc <dcc@logografos.com>2024-05-15 00:57:23 -0700
committerdcc <dcc@logografos.com>2024-05-15 00:57:23 -0700
commitb31a934a804aed3f35442ceafe2080b0955e7317 (patch)
tree947b13a0388ecea81e05dd980baa10f7546860b9 /test/pleroma/web/mastodon_api/views/account_view_test.exs
parentea33a0d3427f8b30b82a6ddbc0ff7429cfaf8d91 (diff)
downloadanni-b31a934a804aed3f35442ceafe2080b0955e7317.tar.gz
anni-b31a934a804aed3f35442ceafe2080b0955e7317.tar.bz2
anni-b31a934a804aed3f35442ceafe2080b0955e7317.zip
total rebaseHEADmaster
Diffstat (limited to 'test/pleroma/web/mastodon_api/views/account_view_test.exs')
-rw-r--r--[-rwxr-xr-x]test/pleroma/web/mastodon_api/views/account_view_test.exs14
1 files changed, 10 insertions, 4 deletions
diff --git a/test/pleroma/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs
index 3bb4970..8dcdaf4 100755..100644
--- a/test/pleroma/web/mastodon_api/views/account_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs
@@ -5,11 +5,13 @@
defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
use Pleroma.DataCase, async: false
+ alias Pleroma.UnstubbedConfigMock, as: ConfigMock
alias Pleroma.User
alias Pleroma.UserRelationship
alias Pleroma.Web.CommonAPI
alias Pleroma.Web.MastodonAPI.AccountView
+ import Mox
import Pleroma.Factory
import Tesla.Mock
@@ -35,7 +37,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
inserted_at: ~N[2017-08-15 15:47:06.597036],
emoji: %{"karjalanpiirakka" => "/file.png"},
raw_bio: "valid html. a\nb\nc\nd\nf '&<>\"",
- also_known_as: ["https://shitposter.zone/users/shp"]
+ also_known_as: ["https://shitposter.zone/users/shp"],
+ last_status_at: NaiveDateTime.utc_now()
})
expected = %{
@@ -74,7 +77,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
fields: []
},
fqn: "shp@shitposter.club",
- last_status_at: nil,
+ last_status_at: user.last_status_at |> NaiveDateTime.to_date() |> Date.to_iso8601(),
pleroma: %{
ap_id: user.ap_id,
also_known_as: ["https://shitposter.zone/users/shp"],
@@ -752,6 +755,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
clear_config([:media_proxy, :enabled], true)
clear_config([:media_preview_proxy, :enabled])
+ ConfigMock
+ |> stub_with(Pleroma.Test.StaticConfig)
+
user =
insert(:user,
avatar: %{"url" => [%{"href" => "https://evil.website/avatar.png"}]},
@@ -759,7 +765,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
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)
AccountView.render("show.json", %{user: user, skip_visibility_check: true})
@@ -777,7 +783,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
true
end)
|> assert()
- end
+ end)
end
test "renders mute expiration date" do