Fix tests with user tasks
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
71476ee587
commit
bba9e6bf59
|
@ -19,7 +19,7 @@ defmodule Mix.Tasks.Mobilizon.Users.Delete do
|
||||||
],
|
],
|
||||||
aliases: [
|
aliases: [
|
||||||
y: :assume_yes,
|
y: :assume_yes,
|
||||||
f: :keep_email
|
k: :keep_email
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -52,13 +52,13 @@ defmodule Mix.Tasks.Mobilizon.UsersTest do
|
||||||
test "delete existing user" do
|
test "delete existing user" do
|
||||||
insert(:user, email: @email)
|
insert(:user, email: @email)
|
||||||
Delete.run([@email, "-y"])
|
Delete.run([@email, "-y"])
|
||||||
assert {:ok, %User{disabled: true}} = Users.get_user_by_email(@email)
|
assert {:error, :user_not_found} = Users.get_user_by_email(@email)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "full delete existing user" do
|
test "full delete existing user" do
|
||||||
insert(:user, email: @email)
|
insert(:user, email: @email)
|
||||||
Delete.run([@email, "-y", "-f"])
|
Delete.run([@email, "-y", "-k"])
|
||||||
assert {:error, :user_not_found} == Users.get_user_by_email(@email)
|
assert {:ok, %User{disabled: true}} = Users.get_user_by_email(@email)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "delete non-existing user" do
|
test "delete non-existing user" do
|
||||||
|
@ -68,14 +68,18 @@ defmodule Mix.Tasks.Mobilizon.UsersTest do
|
||||||
|
|
||||||
describe "show user" do
|
describe "show user" do
|
||||||
test "show existing user" do
|
test "show existing user" do
|
||||||
%User{confirmed_at: confirmed_at, role: role} = user = insert(:user, email: @email)
|
%User{confirmed_at: confirmed_at, role: role, disabled: disabled} =
|
||||||
|
user = insert(:user, email: @email)
|
||||||
|
|
||||||
actor1 = insert(:actor, user: user)
|
actor1 = insert(:actor, user: user)
|
||||||
actor2 = insert(:actor, user: user)
|
actor2 = insert(:actor, user: user)
|
||||||
|
|
||||||
output =
|
output =
|
||||||
"Informations for the user #{@email}:\n - Activated: #{confirmed_at}\n - Role: #{role}\n Identities (2):\n - @#{
|
"Informations for the user #{@email}:\n - Activated: #{confirmed_at}\n - Disabled: #{
|
||||||
actor1.preferred_username
|
disabled
|
||||||
} / \n - @#{actor2.preferred_username} / \n\n\n"
|
}\n - Role: #{role}\n Identities (2):\n - @#{actor1.preferred_username} / \n - @#{
|
||||||
|
actor2.preferred_username
|
||||||
|
} / \n\n\n"
|
||||||
|
|
||||||
Show.run([@email])
|
Show.run([@email])
|
||||||
assert_received {:mix_shell, :info, [output_received]}
|
assert_received {:mix_shell, :info, [output_received]}
|
||||||
|
|
Loading…
Reference in a new issue