forked from potsda.mn/mobilizon
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_email_domain: :boolean,
|
||||||
all_matching_ip: :boolean,
|
all_matching_ip: :boolean,
|
||||||
include_groups_where_admin: :boolean,
|
include_groups_where_admin: :boolean,
|
||||||
|
keep_email: :boolean,
|
||||||
help: :boolean
|
help: :boolean
|
||||||
],
|
],
|
||||||
aliases: [
|
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)
|
Delete.delete(actor, actor, true)
|
||||||
end) do
|
end) do
|
||||||
# Delete user
|
# Delete user
|
||||||
Users.delete_user(user, reserve_email: false)
|
Users.delete_user(user, reserve_email: Keyword.get(options, :keep_email, false))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -191,6 +193,9 @@ defmodule Mix.Tasks.Mobilizon.Users.Delete do
|
||||||
--all-matching-ip
|
--all-matching-ip
|
||||||
Delete all users matching the given input as email domain
|
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
|
-h/--help
|
||||||
Show the help
|
Show the help
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,7 @@ defmodule Mix.Tasks.Mobilizon.UsersTest do
|
||||||
test "delete non-existing user" do
|
test "delete non-existing user" do
|
||||||
Delete.run([@email, "-y"])
|
Delete.run([@email, "-y"])
|
||||||
assert_received {:mix_shell, :error, [message]}
|
assert_received {:mix_shell, :error, [message]}
|
||||||
assert message =~ "Error: No such user"
|
assert message == "No user with the email \"#{@email}\" was found"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue