tests: user: add regression test for remote_or_auth_active?/1
authorWilliam Pitcock <nenolod@dereferenced.org>
Wed, 9 Jan 2019 05:02:00 +0000 (05:02 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Wed, 9 Jan 2019 06:02:18 +0000 (06:02 +0000)
test/user_test.exs

index 74accb7c8a99ecd8458ea9350c62c2f994131090..419a576dc3bce04ff28e8f06086f891d4dc2e0d9 100644 (file)
@@ -767,4 +767,18 @@ defmodule Pleroma.UserTest do
                |> Map.put(:search_distance, nil)
     end
   end
+
+  test "remote_or_auth_active?/1 works correctly" do
+    Pleroma.Config.put([:instance, :account_activation_required], true)
+
+    local_user = insert(:user, local: true, info: %{confirmation_pending: true})
+    confirmed_user = insert(:user, local: true, info: %{confirmation_pending: false})
+    remote_user = insert(:user, local: false)
+
+    refute User.remote_or_auth_active?(local_user)
+    assert User.remote_or_auth_active?(confirmed_user)
+    assert User.remote_or_auth_active?(remote_user)
+
+    Pleroma.Config.put([:instance, :account_activation_required], false)
+  end
 end