diff options
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)  | 
