tests: user: add regression test for remote_or_auth_active?/1

This commit is contained in:
William Pitcock 2019-01-09 05:02:00 +00:00
parent 595a970493
commit 4124c9aa4a
1 changed files with 14 additions and 0 deletions

View File

@ -767,4 +767,18 @@ test "finds a user whose name is nil" 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