diff options
| author | Sachin Joshi <satchin.joshi@gmail.com> | 2019-05-01 00:21:30 +0545 |
|---|---|---|
| committer | Sachin Joshi <satchin.joshi@gmail.com> | 2019-05-01 00:21:30 +0545 |
| commit | cd6da3606b0170b1a5c7d64b96f1621896cc0930 (patch) | |
| tree | 76086dd4145017de644bdeb17a389bb4d8c7a298 /test/web/mastodon_api/status_view_test.exs | |
| parent | 963d5774af7efb57fa306b3ac164049f8958a72c (diff) | |
| parent | 77690b9d03facf74483e3379f72b5b51c9f1bd4e (diff) | |
| download | pleroma-cd6da3606b0170b1a5c7d64b96f1621896cc0930.tar.gz pleroma-cd6da3606b0170b1a5c7d64b96f1621896cc0930.zip | |
Merge branch 'develop' into bugfix/web-notification-special-char
Diffstat (limited to 'test/web/mastodon_api/status_view_test.exs')
| -rw-r--r-- | test/web/mastodon_api/status_view_test.exs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/web/mastodon_api/status_view_test.exs b/test/web/mastodon_api/status_view_test.exs index a02c7c210..5fddc6c58 100644 --- a/test/web/mastodon_api/status_view_test.exs +++ b/test/web/mastodon_api/status_view_test.exs @@ -6,6 +6,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do use Pleroma.DataCase alias Pleroma.Activity + alias Pleroma.Bookmark alias Pleroma.Object alias Pleroma.Repo alias Pleroma.User @@ -128,6 +129,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do pleroma: %{ local: true, conversation_id: convo_id, + in_reply_to_account_acct: nil, content: %{"text/plain" => HtmlSanitizeEx.strip_tags(note.data["object"]["content"])}, spoiler_text: %{"text/plain" => HtmlSanitizeEx.strip_tags(note.data["object"]["summary"])} } @@ -152,6 +154,25 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do assert status.muted == true end + test "tells if the status is bookmarked" do + user = insert(:user) + + {:ok, activity} = CommonAPI.post(user, %{"status" => "Cute girls doing cute things"}) + status = StatusView.render("status.json", %{activity: activity}) + + assert status.bookmarked == false + + status = StatusView.render("status.json", %{activity: activity, for: user}) + + assert status.bookmarked == false + + {:ok, _bookmark} = Bookmark.create(user.id, activity.id) + + status = StatusView.render("status.json", %{activity: activity, for: user}) + + assert status.bookmarked == true + end + test "a reply" do note = insert(:note_activity) user = insert(:user) @@ -178,7 +199,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do status = StatusView.render("status.json", %{activity: activity}) - actor = User.get_by_ap_id(activity.actor) + actor = User.get_cached_by_ap_id(activity.actor) assert status.mentions == Enum.map([user, actor], fn u -> AccountView.render("mention.json", %{user: u}) end) |
