diff options
author | kaniini <nenolod@gmail.com> | 2019-04-28 00:21:32 +0000 |
---|---|---|
committer | kaniini <nenolod@gmail.com> | 2019-04-28 00:21:32 +0000 |
commit | f2a4156d4969dee37c88e0d540eff04176673af7 (patch) | |
tree | e569cce24843fb1751996727cc7aa66af14cadb1 /test | |
parent | 002ea343f8c6dc9669bce91942f835a2c7cc6ae7 (diff) | |
parent | c3e9fcf098e4ec17a387fe264193dca4dda2dd77 (diff) | |
download | pleroma-f2a4156d4969dee37c88e0d540eff04176673af7.tar.gz pleroma-f2a4156d4969dee37c88e0d540eff04176673af7.zip |
Merge branch 'fix/bookmark-depend-on-embeded-object' into 'develop'
Fix bookmarks depending on embeded object and move checking if the status is bookmarked to SQL
See merge request pleroma/pleroma!1099
Diffstat (limited to 'test')
-rw-r--r-- | test/bookmark_test.exs | 15 | ||||
-rw-r--r-- | test/web/mastodon_api/status_view_test.exs | 20 |
2 files changed, 35 insertions, 0 deletions
diff --git a/test/bookmark_test.exs b/test/bookmark_test.exs index 3be148023..b81c102ef 100644 --- a/test/bookmark_test.exs +++ b/test/bookmark_test.exs @@ -34,4 +34,19 @@ defmodule Pleroma.BookmarkTest do {:ok, _deleted_bookmark} = Bookmark.destroy(user.id, activity.id) end end + + describe "get/2" do + test "gets a bookmark" do + user = insert(:user) + + {:ok, activity} = + CommonAPI.post(user, %{ + "status" => + "Scientists Discover The Secret Behind Tenshi Eating A Corndog Being So Cute – Science Daily" + }) + + {:ok, bookmark} = Bookmark.create(user.id, activity.id) + assert bookmark == Bookmark.get(user.id, activity.id) + end + end end diff --git a/test/web/mastodon_api/status_view_test.exs b/test/web/mastodon_api/status_view_test.exs index f74726212..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 @@ -153,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) |