mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
AccountView: Add test, refactor
This commit is contained in:
parent
6a191a91ab
commit
ef8a2134bc
2 changed files with 4 additions and 6 deletions
|
@ -250,11 +250,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
||||||
end
|
end
|
||||||
|
|
||||||
last_status_at =
|
last_status_at =
|
||||||
if not is_nil(user.last_status_at) do
|
user.last_status_at &&
|
||||||
user.last_status_at |> NaiveDateTime.to_date() |> Date.to_iso8601()
|
user.last_status_at |> NaiveDateTime.to_date() |> Date.to_iso8601()
|
||||||
else
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
|
|
||||||
%{
|
%{
|
||||||
id: to_string(user.id),
|
id: to_string(user.id),
|
||||||
|
|
|
@ -35,7 +35,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|
||||||
inserted_at: ~N[2017-08-15 15:47:06.597036],
|
inserted_at: ~N[2017-08-15 15:47:06.597036],
|
||||||
emoji: %{"karjalanpiirakka" => "/file.png"},
|
emoji: %{"karjalanpiirakka" => "/file.png"},
|
||||||
raw_bio: "valid html. a\nb\nc\nd\nf '&<>\"",
|
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 = %{
|
expected = %{
|
||||||
|
@ -74,7 +75,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|
||||||
fields: []
|
fields: []
|
||||||
},
|
},
|
||||||
fqn: "shp@shitposter.club",
|
fqn: "shp@shitposter.club",
|
||||||
last_status_at: nil,
|
last_status_at: user.last_status_at |> NaiveDateTime.to_date() |> Date.to_iso8601(),
|
||||||
pleroma: %{
|
pleroma: %{
|
||||||
ap_id: user.ap_id,
|
ap_id: user.ap_id,
|
||||||
also_known_as: ["https://shitposter.zone/users/shp"],
|
also_known_as: ["https://shitposter.zone/users/shp"],
|
||||||
|
|
Loading…
Reference in a new issue