test: fix user deletion CLI tests and bring back the -k option
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
860b4eb9a3
commit
d2490f9304
|
@ -21,11 +21,13 @@ defmodule Mix.Tasks.Mobilizon.Users.Delete do
|
|||
all_matching_email_domain: :boolean,
|
||||
all_matching_ip: :boolean,
|
||||
include_groups_where_admin: :boolean,
|
||||
keep_email: :boolean,
|
||||
help: :boolean
|
||||
],
|
||||
aliases: [
|
||||
y: :assume_yes,
|
||||
h: :help
|
||||
h: :help,
|
||||
k: :keep_email,
|
||||
y: :assume_yes
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -156,7 +158,7 @@ defmodule Mix.Tasks.Mobilizon.Users.Delete do
|
|||
Delete.delete(actor, actor, true)
|
||||
end) do
|
||||
# Delete user
|
||||
Users.delete_user(user, reserve_email: false)
|
||||
Users.delete_user(user, reserve_email: Keyword.get(options, :keep_email, false))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -191,6 +193,9 @@ defmodule Mix.Tasks.Mobilizon.Users.Delete do
|
|||
--all-matching-ip
|
||||
Delete all users matching the given input as email domain
|
||||
|
||||
-k/--keep-email
|
||||
Keep a record of the email in the users table so that the email can't be used to register again
|
||||
|
||||
-h/--help
|
||||
Show the help
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ defmodule Mix.Tasks.Mobilizon.UsersTest do
|
|||
test "delete non-existing user" do
|
||||
Delete.run([@email, "-y"])
|
||||
assert_received {:mix_shell, :error, [message]}
|
||||
assert message =~ "Error: No such user"
|
||||
assert message == "No user with the email \"#{@email}\" was found"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue