logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 210aa42f74494864d70f97711204938cbcc4a19a
parent 4cb166e979ea66a1c79995dacacbcf44fbf7365f
Author: feld <feld@feld.me>
Date:   Tue,  2 Mar 2021 18:40:35 +0000

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

Status application field: test improvements

See merge request pleroma/pleroma!3356

Diffstat:

Mlib/pleroma/web/mastodon_api/views/status_view.ex4+++-
Mtest/pleroma/web/mastodon_api/controllers/status_controller_test.exs21+++++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -536,6 +536,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do end @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 end diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -377,6 +377,17 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do }) 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 %{ "content" => "cofe is my copilot", "application" => %{ "name" => ^app_name, @@ -396,6 +407,16 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do "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 %{ "content" => "club mate is my wingman", "application" => nil