diff options
author | Mark Felder <feld@FreeBSD.org> | 2019-07-09 12:49:04 -0500 |
---|---|---|
committer | Mark Felder <feld@FreeBSD.org> | 2019-07-09 12:49:04 -0500 |
commit | 9a9b60cfbcbcdf3e48e42aa75ff530007cf03b96 (patch) | |
tree | fc28e2fb05ad0158fe881de7a49e90d941e10ad4 /test/web/mastodon_api | |
parent | 9f235028569968871ef9ea933459c6e9369e737a (diff) | |
parent | e19e82975871388831fd23adc50fcaaea85ad5da (diff) | |
download | pleroma-9a9b60cfbcbcdf3e48e42aa75ff530007cf03b96.tar.gz pleroma-9a9b60cfbcbcdf3e48e42aa75ff530007cf03b96.zip |
Merge branch 'develop' into feature/allow-user-query-via-id
Diffstat (limited to 'test/web/mastodon_api')
-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 |