diff options
author | Karen Konou <konoukaren@gmail.com> | 2019-02-11 11:59:51 +0100 |
---|---|---|
committer | Karen Konou <konoukaren@gmail.com> | 2019-02-11 12:04:02 +0100 |
commit | c01ef574c192488c2643a20b4064439757613449 (patch) | |
tree | aab1f1142133e1d789c71092061a9c97a73bee67 /test/web/common_api/common_api_test.exs | |
parent | cc21fc5f537510416a088adff085b675de1be58e (diff) | |
download | pleroma-c01ef574c192488c2643a20b4064439757613449.tar.gz pleroma-c01ef574c192488c2643a20b4064439757613449.zip |
Refactor as per Rin's suggestions, add endpoint tests
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-rw-r--r-- | test/web/common_api/common_api_test.exs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index a7d9e6161..d26b6e49c 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -164,4 +164,30 @@ defmodule Pleroma.Web.CommonAPI.Test do assert %User{info: %{pinned_activities: []}} = user end end + + describe "mute tests" do + setup do + user = insert(:user) + + activity = insert(:note_activity) + + [user: user, activity: activity] + end + + test "add mute", %{user: user, activity: activity} do + {:ok, _} = CommonAPI.add_mute(user, activity) + assert CommonAPI.thread_muted?(user, activity) + end + + test "remove mute", %{user: user, activity: activity} do + CommonAPI.add_mute(user, activity) + {:ok, _} = CommonAPI.remove_mute(user, activity) + refute CommonAPI.thread_muted?(user, activity) + end + + test "check that mutes can't be duplicate", %{user: user, activity: activity} do + CommonAPI.add_mute(user, activity) + {:error, _} = CommonAPI.add_mute(user, activity) + end + end end |