Add test for expiring mutes
authorRoman Chvanikov <chvanikoff@pm.me>
Tue, 8 Sep 2020 11:11:00 +0000 (14:11 +0300)
committerRoman Chvanikov <chvanikoff@pm.me>
Tue, 8 Sep 2020 11:11:00 +0000 (14:11 +0300)
test/user_test.exs

index b23e36be311fac73c17b4b5d3a5ff7809a5c40cc..83c017ec54404584edb605466ee387d5fb25c96b 100644 (file)
@@ -963,6 +963,19 @@ defmodule Pleroma.UserTest do
       assert User.muted_notifications?(user, muted_user)
     end
 
+    test "expiring" do
+      user = insert(:user)
+      muted_user = insert(:user)
+
+      {:ok, _user_relationships} = User.mute(user, muted_user, %{expires_in: 60})
+      assert User.mutes?(user, muted_user)
+
+      assert_enqueued(
+        worker: Pleroma.Workers.MuteExpireWorker,
+        args: %{"op" => "unmute", "muter" => user.id, "mutee" => muted_user.id}
+      )
+    end
+
     test "it unmutes users" do
       user = insert(:user)
       muted_user = insert(:user)