Refactor as per Rin's suggestions, add endpoint tests
This commit is contained in:
parent
cc21fc5f53
commit
c01ef574c1
9 changed files with 136 additions and 105 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue