Merge branch 'application-to-generator' into 'develop'

Status application field: test improvements

See merge request pleroma/pleroma!3356
This commit is contained in:
feld 2021-03-02 18:40:35 +00:00
commit 210aa42f74
2 changed files with 24 additions and 1 deletions

View File

@ -536,6 +536,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
end end
@spec build_application(map() | nil) :: map() | nil @spec build_application(map() | nil) :: map() | nil
defp build_application(%{type: _type, name: name, url: url}), do: %{name: name, website: url} defp build_application(%{"type" => _type, "name" => name, "url" => url}),
do: %{name: name, website: url}
defp build_application(_), do: nil defp build_application(_), do: nil
end end

View File

@ -376,6 +376,17 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
"status" => "cofe is my copilot" "status" => "cofe is my copilot"
}) })
assert %{
"content" => "cofe is my copilot"
} = json_response_and_validate_schema(result, 200)
activity = result.assigns.activity.id
result =
conn
|> put_req_header("content-type", "application/json")
|> get("api/v1/statuses/#{activity}")
assert %{ assert %{
"content" => "cofe is my copilot", "content" => "cofe is my copilot",
"application" => %{ "application" => %{
@ -396,6 +407,16 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
"status" => "club mate is my wingman" "status" => "club mate is my wingman"
}) })
assert %{"content" => "club mate is my wingman"} =
json_response_and_validate_schema(result, 200)
activity = result.assigns.activity.id
result =
conn
|> put_req_header("content-type", "application/json")
|> get("api/v1/statuses/#{activity}")
assert %{ assert %{
"content" => "club mate is my wingman", "content" => "club mate is my wingman",
"application" => nil "application" => nil