diff options
author | raeno <just.raeno@gmail.com> | 2018-12-14 20:28:35 +0100 |
---|---|---|
committer | raeno <just.raeno@gmail.com> | 2018-12-14 20:28:35 +0100 |
commit | 90b00701ff0e2622825ef4c86409a27691763baf (patch) | |
tree | 7fa693fe9ce921b50d103d2c61c4b9a9de28a91f /test/web/common_api/common_api_test.exs | |
parent | 9ff61ed793b7fd968b51c5f6e4b72958adeae977 (diff) | |
parent | 980131b4db4f2da319d9054889bdb962aa8c837e (diff) | |
download | pleroma-90b00701ff0e2622825ef4c86409a27691763baf.tar.gz pleroma-90b00701ff0e2622825ef4c86409a27691763baf.zip |
Merge branch 'develop' into oembed_provider
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-rw-r--r-- | test/web/common_api/common_api_test.exs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index 8fc65f4c0..0b5a235f8 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -2,6 +2,7 @@ defmodule Pleroma.Web.CommonAPI.Test do use Pleroma.DataCase alias Pleroma.Web.CommonAPI alias Pleroma.User + alias Pleroma.Activity import Pleroma.Factory @@ -53,4 +54,42 @@ defmodule Pleroma.Web.CommonAPI.Test do assert content == "<p><b>2hu</b></p>alert('xss')" end end + + describe "reactions" do + test "repeating a status" do + user = insert(:user) + other_user = insert(:user) + + {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"}) + + {:ok, %Activity{}, _} = CommonAPI.repeat(activity.id, user) + end + + test "favoriting a status" do + user = insert(:user) + other_user = insert(:user) + + {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"}) + + {:ok, %Activity{}, _} = CommonAPI.favorite(activity.id, user) + end + + test "retweeting a status twice returns an error" do + user = insert(:user) + other_user = insert(:user) + + {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"}) + {:ok, %Activity{}, _object} = CommonAPI.repeat(activity.id, user) + {:error, _} = CommonAPI.repeat(activity.id, user) + end + + test "favoriting a status twice returns an error" do + user = insert(:user) + other_user = insert(:user) + + {:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"}) + {:ok, %Activity{}, _object} = CommonAPI.favorite(activity.id, user) + {:error, _} = CommonAPI.favorite(activity.id, user) + end + end end |