summaryrefslogtreecommitdiff
path: root/test/pleroma/web/mastodon_api/views
diff options
context:
space:
mode:
Diffstat (limited to 'test/pleroma/web/mastodon_api/views')
-rw-r--r--test/pleroma/web/mastodon_api/views/account_view_test.exs23
-rw-r--r--test/pleroma/web/mastodon_api/views/status_view_test.exs12
2 files changed, 28 insertions, 7 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 5373a17c3..60881756d 100644
--- a/test/pleroma/web/mastodon_api/views/account_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs
@@ -468,6 +468,23 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
%{user: user, for: user}
)[:pleroma][:unread_notifications_count] == 7
end
+
+ test "shows email only to the account owner" do
+ user = insert(:user)
+ other_user = insert(:user)
+
+ user = User.get_cached_by_ap_id(user.ap_id)
+
+ assert AccountView.render(
+ "show.json",
+ %{user: user, for: other_user}
+ )[:pleroma][:email] == nil
+
+ assert AccountView.render(
+ "show.json",
+ %{user: user, for: user}
+ )[:pleroma][:email] == user.email
+ end
end
describe "follow requests counter" do
@@ -562,12 +579,12 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
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())
+ String.starts_with?(url, Pleroma.Web.Endpoint.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())
+ String.starts_with?(url, Pleroma.Web.Endpoint.url()) &&
+ String.starts_with?(static_url, Pleroma.Web.Endpoint.url())
end)
_ ->
diff --git a/test/pleroma/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs
index 2de3afc4f..9dfdf8bf0 100644
--- a/test/pleroma/web/mastodon_api/views/status_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs
@@ -262,8 +262,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
mentions: [],
tags: [
%{
- name: "#{object_data["tag"]}",
- url: "http://localhost:4001/tag/#{object_data["tag"]}"
+ name: "#{hd(object_data["tag"])}",
+ url: "http://localhost:4001/tag/#{hd(object_data["tag"])}"
}
],
application: nil,
@@ -286,7 +286,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
direct_conversation_id: nil,
thread_muted: false,
emoji_reactions: [],
- parent_visible: false
+ parent_visible: false,
+ pinned_at: nil
}
}
@@ -458,7 +459,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
"url" => [
%{
"mediaType" => "image/png",
- "href" => "someurl"
+ "href" => "someurl",
+ "width" => 200,
+ "height" => 100
}
],
"blurhash" => "UJJ8X[xYW,%Jtq%NNFbXB5j]IVM|9GV=WHRn",
@@ -474,6 +477,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
text_url: "someurl",
description: nil,
pleroma: %{mime_type: "image/png"},
+ meta: %{original: %{width: 200, height: 100, aspect: 2}},
blurhash: "UJJ8X[xYW,%Jtq%NNFbXB5j]IVM|9GV=WHRn"
}