X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fmastodon_api%2Faccount_view_test.exs;h=de6aeec720a9fc229830ed02a48e8bd4b708fdee;hb=6aa5b39837b943a7a8fd5c6d1d617c74e933e088;hp=a24f2a050ff7702a93427340443865de971b29a0;hpb=3c4cab9be18ff543d025177b418ddd0b16050e68;p=akkoma
diff --git a/test/web/mastodon_api/account_view_test.exs b/test/web/mastodon_api/account_view_test.exs
index a24f2a050..de6aeec72 100644
--- a/test/web/mastodon_api/account_view_test.exs
+++ b/test/web/mastodon_api/account_view_test.exs
@@ -19,9 +19,18 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
]
}
+ background_image = %{
+ "url" => [%{"href" => "https://example.com/images/asuka_hospital.png"}]
+ }
+
user =
insert(:user, %{
- info: %{note_count: 5, follower_count: 3, source_data: source_data},
+ info: %{
+ note_count: 5,
+ follower_count: 3,
+ source_data: source_data,
+ background: background_image
+ },
nickname: "shp@shitposter.club",
name: ":karjalanpiirakka: shp",
bio: "valid html",
@@ -55,11 +64,12 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
fields: [],
bot: false,
source: %{
- note: "",
+ note: "valid html",
sensitive: false,
pleroma: %{}
},
pleroma: %{
+ background_image: "https://example.com/images/asuka_hospital.png",
confirmation_pending: false,
tags: [],
is_admin: false,
@@ -67,7 +77,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
hide_favorites: true,
hide_followers: false,
hide_follows: false,
- relationship: %{}
+ relationship: %{},
+ skip_thread_containment: false
}
}
@@ -78,10 +89,10 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
user = insert(:user)
notification_settings = %{
- "remote" => true,
- "local" => true,
"followers" => true,
- "follows" => true
+ "follows" => true,
+ "non_follows" => true,
+ "non_followers" => true
}
privacy = user.info.default_scope
@@ -120,11 +131,12 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
fields: [],
bot: true,
source: %{
- note: "",
+ note: user.bio,
sensitive: false,
pleroma: %{}
},
pleroma: %{
+ background_image: nil,
confirmation_pending: false,
tags: [],
is_admin: false,
@@ -132,7 +144,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
hide_favorites: true,
hide_followers: false,
hide_follows: false,
- relationship: %{}
+ relationship: %{},
+ skip_thread_containment: false
}
}
@@ -209,11 +222,12 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
fields: [],
bot: true,
source: %{
- note: "",
+ note: user.bio,
sensitive: false,
pleroma: %{}
},
pleroma: %{
+ background_image: nil,
confirmation_pending: false,
tags: [],
is_admin: false,
@@ -233,10 +247,32 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
domain_blocking: false,
showing_reblogs: true,
endorsed: false
- }
+ },
+ skip_thread_containment: false
}
}
assert expected == AccountView.render("account.json", %{user: user, for: other_user})
end
+
+ test "returns the settings store if the requesting user is the represented user and it's requested specifically" do
+ user = insert(:user, %{info: %User.Info{pleroma_settings_store: %{fe: "test"}}})
+
+ result =
+ AccountView.render("account.json", %{user: user, for: user, with_pleroma_settings: true})
+
+ assert result.pleroma.settings_store == %{:fe => "test"}
+
+ result = AccountView.render("account.json", %{user: user, with_pleroma_settings: true})
+ assert result.pleroma[:settings_store] == nil
+
+ result = AccountView.render("account.json", %{user: user, for: user})
+ assert result.pleroma[:settings_store] == nil
+ end
+
+ test "sanitizes display names" do
+ user = insert(:user, name: "")
+ result = AccountView.render("account.json", %{user: user})
+ refute result.display_name == ""
+ end
end