diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2019-07-08 20:40:59 +0000 |
---|---|---|
committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2019-07-08 20:40:59 +0000 |
commit | 3a406db430ea603edc080689a679c8e51e1be2b7 (patch) | |
tree | a6ea2ad20e23230a86bf54d0ed67f1e6fb0ebc12 /test | |
parent | 3589b30ddc9d0c23ca6f00264cff05e53be1b270 (diff) | |
parent | 72b88c82bc038c8ecf6eba2012582f495f30ef43 (diff) | |
download | pleroma-3a406db430ea603edc080689a679c8e51e1be2b7.tar.gz pleroma-3a406db430ea603edc080689a679c8e51e1be2b7.zip |
Merge branch 'fix/relationships-in-statuses' into 'develop'
Mastodon API: Fix embedded relationships not being rendered inside of statuses
See merge request pleroma/pleroma!1387
Diffstat (limited to 'test')
-rw-r--r-- | test/web/mastodon_api/status_view_test.exs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/web/mastodon_api/status_view_test.exs b/test/web/mastodon_api/status_view_test.exs index ec75150ab..73791a95b 100644 --- a/test/web/mastodon_api/status_view_test.exs +++ b/test/web/mastodon_api/status_view_test.exs @@ -444,4 +444,39 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do assert Enum.at(result[:options], 2)[:votes_count] == 1 end end + + test "embeds a relationship in the account" do + user = insert(:user) + other_user = insert(:user) + + {:ok, activity} = + CommonAPI.post(user, %{ + "status" => "drink more water" + }) + + result = StatusView.render("status.json", %{activity: activity, for: other_user}) + + assert result[:account][:pleroma][:relationship] == + AccountView.render("relationship.json", %{user: other_user, target: user}) + end + + test "embeds a relationship in the account in reposts" do + user = insert(:user) + other_user = insert(:user) + + {:ok, activity} = + CommonAPI.post(user, %{ + "status" => "˙˙ɐʎns" + }) + + {:ok, activity, _object} = CommonAPI.repeat(activity.id, other_user) + + result = StatusView.render("status.json", %{activity: activity, for: user}) + + assert result[:account][:pleroma][:relationship] == + AccountView.render("relationship.json", %{user: user, target: other_user}) + + assert result[:reblog][:account][:pleroma][:relationship] == + AccountView.render("relationship.json", %{user: user, target: user}) + end end |