added another test
[akkoma] / test / web / thread_mute_test.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.ThreadMuteTest do
6 use Pleroma.DataCase
7 import Pleroma.Web.ThreadMute
8
9 import Pleroma.Factory
10
11 describe "mute tests" do
12 setup do
13 user = insert(:user, %{id: "1"})
14
15 activity =
16 insert(:note_activity, %{
17 data: %{
18 "context" => "http://localhost:4000/contexts/361ca23e-ffa7-4773-b981-a355a18dc592"
19 }
20 })
21
22 [user: user, activity: activity]
23 end
24
25 test "add mute", %{user: user, activity: activity} do
26 id = activity.id
27 {:ok, mute} = add_mute(user, id)
28
29 assert mute.user_id == "1"
30 assert mute.context == "http://localhost:4000/contexts/361ca23e-ffa7-4773-b981-a355a18dc592"
31 end
32
33 test "remove mute", %{user: user, activity: activity} do
34 id = activity.id
35
36 add_mute(user, id)
37 {1, nil} = remove_mute(user, id)
38 end
39 end
40 end