2019-02-09 13:23:51 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
|
|
|
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.ThreadMuteTest do
|
|
|
|
use Pleroma.DataCase
|
|
|
|
import Pleroma.Web.ThreadMute
|
|
|
|
|
|
|
|
import Pleroma.Factory
|
|
|
|
|
2019-02-09 13:34:42 +00:00
|
|
|
describe "mute tests" do
|
|
|
|
setup do
|
2019-02-09 16:47:57 +00:00
|
|
|
user = insert(:user)
|
2019-02-09 13:23:51 +00:00
|
|
|
|
2019-02-09 16:47:57 +00:00
|
|
|
activity = insert(:note_activity)
|
2019-02-09 13:23:51 +00:00
|
|
|
|
2019-02-09 13:34:42 +00:00
|
|
|
[user: user, activity: activity]
|
|
|
|
end
|
2019-02-09 13:23:51 +00:00
|
|
|
|
2019-02-09 13:34:42 +00:00
|
|
|
test "add mute", %{user: user, activity: activity} do
|
|
|
|
id = activity.id
|
2019-02-09 16:47:57 +00:00
|
|
|
{:ok, _activity} = add_mute(user, id)
|
2019-02-09 13:34:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test "remove mute", %{user: user, activity: activity} do
|
|
|
|
id = activity.id
|
|
|
|
|
|
|
|
add_mute(user, id)
|
2019-02-09 16:47:57 +00:00
|
|
|
{:ok, _activity} = remove_mute(user, id)
|
|
|
|
end
|
|
|
|
|
|
|
|
test "check mute", %{user: user, activity: activity} do
|
|
|
|
id = activity.id
|
|
|
|
|
|
|
|
add_mute(user, id)
|
|
|
|
assert muted?(user, activity)
|
|
|
|
remove_mute(user, id)
|
|
|
|
refute muted?(user, activity)
|
2019-02-09 13:34:42 +00:00
|
|
|
end
|
2019-02-09 13:23:51 +00:00
|
|
|
end
|
|
|
|
end
|