Only need to test if unconfirmed users are successfully deleted

It's no longer possible to have an active user account with User.is_confirmed == false
This commit is contained in:
Mark Felder 2021-01-20 11:26:14 -06:00
parent 3cb4d40ebf
commit 5d344e5c79
1 changed files with 7 additions and 23 deletions

View File

@ -1563,14 +1563,9 @@ test "it deactivates a user, all follow relationships and all activities", %{use
end end
end end
describe "delete/1 when confirmation is pending" do test "delete/1 when confirmation is pending deletes the user" do
setup do
user = insert(:user, is_confirmed: false)
{:ok, user: user}
end
test "deletes user from database when activation required", %{user: user} do
clear_config([:instance, :account_activation_required], true) clear_config([:instance, :account_activation_required], true)
user = insert(:user, is_confirmed: false)
{:ok, job} = User.delete(user) {:ok, job} = User.delete(user)
{:ok, _} = ObanHelpers.perform(job) {:ok, _} = ObanHelpers.perform(job)
@ -1579,17 +1574,6 @@ test "deletes user from database when activation required", %{user: user} do
refute User.get_by_id(user.id) refute User.get_by_id(user.id)
end end
test "deactivates user when activation is not required", %{user: user} do
clear_config([:instance, :account_activation_required], false)
{:ok, job} = User.delete(user)
{:ok, _} = ObanHelpers.perform(job)
assert %{deactivated: true} = User.get_cached_by_id(user.id)
assert %{deactivated: true} = User.get_by_id(user.id)
end
end
test "delete/1 when approval is pending deletes the user" do test "delete/1 when approval is pending deletes the user" do
user = insert(:user, is_approved: false) user = insert(:user, is_approved: false)