mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-02 09:45:13 +00:00
Add test for pleroma.user set --confirmed
Order now matters because of testing shell_info
This commit is contained in:
parent
bccef4b997
commit
6c79a60649
|
@ -225,47 +225,64 @@ defmodule Mix.Tasks.Pleroma.UserTest do
|
||||||
test "All statuses set" do
|
test "All statuses set" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
Mix.Tasks.Pleroma.User.run(["set", user.nickname, "--moderator", "--admin", "--locked"])
|
Mix.Tasks.Pleroma.User.run([
|
||||||
|
"set",
|
||||||
|
user.nickname,
|
||||||
|
"--admin",
|
||||||
|
"--confirmed",
|
||||||
|
"--locked",
|
||||||
|
"--moderator"
|
||||||
|
])
|
||||||
|
|
||||||
assert_received {:mix_shell, :info, [message]}
|
assert_received {:mix_shell, :info, [message]}
|
||||||
assert message =~ ~r/Moderator status .* true/
|
assert message =~ ~r/Admin status .* true/
|
||||||
|
|
||||||
|
assert_received {:mix_shell, :info, [message]}
|
||||||
|
assert message =~ ~r/Confirmation pending .* false/
|
||||||
|
|
||||||
assert_received {:mix_shell, :info, [message]}
|
assert_received {:mix_shell, :info, [message]}
|
||||||
assert message =~ ~r/Locked status .* true/
|
assert message =~ ~r/Locked status .* true/
|
||||||
|
|
||||||
assert_received {:mix_shell, :info, [message]}
|
assert_received {:mix_shell, :info, [message]}
|
||||||
assert message =~ ~r/Admin status .* true/
|
assert message =~ ~r/Moderator status .* true/
|
||||||
|
|
||||||
user = User.get_cached_by_nickname(user.nickname)
|
user = User.get_cached_by_nickname(user.nickname)
|
||||||
assert user.is_moderator
|
assert user.is_moderator
|
||||||
assert user.locked
|
assert user.locked
|
||||||
assert user.is_admin
|
assert user.is_admin
|
||||||
|
refute user.confirmation_pending
|
||||||
end
|
end
|
||||||
|
|
||||||
test "All statuses unset" do
|
test "All statuses unset" do
|
||||||
user = insert(:user, locked: true, is_moderator: true, is_admin: true)
|
user =
|
||||||
|
insert(:user, locked: true, is_moderator: true, is_admin: true, confirmation_pending: true)
|
||||||
|
|
||||||
Mix.Tasks.Pleroma.User.run([
|
Mix.Tasks.Pleroma.User.run([
|
||||||
"set",
|
"set",
|
||||||
user.nickname,
|
user.nickname,
|
||||||
"--no-moderator",
|
|
||||||
"--no-admin",
|
"--no-admin",
|
||||||
"--no-locked"
|
"--no-confirmed",
|
||||||
|
"--no-locked",
|
||||||
|
"--no-moderator"
|
||||||
])
|
])
|
||||||
|
|
||||||
assert_received {:mix_shell, :info, [message]}
|
assert_received {:mix_shell, :info, [message]}
|
||||||
assert message =~ ~r/Moderator status .* false/
|
assert message =~ ~r/Admin status .* false/
|
||||||
|
|
||||||
|
assert_received {:mix_shell, :info, [message]}
|
||||||
|
assert message =~ ~r/Confirmation pending .* true/
|
||||||
|
|
||||||
assert_received {:mix_shell, :info, [message]}
|
assert_received {:mix_shell, :info, [message]}
|
||||||
assert message =~ ~r/Locked status .* false/
|
assert message =~ ~r/Locked status .* false/
|
||||||
|
|
||||||
assert_received {:mix_shell, :info, [message]}
|
assert_received {:mix_shell, :info, [message]}
|
||||||
assert message =~ ~r/Admin status .* false/
|
assert message =~ ~r/Moderator status .* false/
|
||||||
|
|
||||||
user = User.get_cached_by_nickname(user.nickname)
|
user = User.get_cached_by_nickname(user.nickname)
|
||||||
refute user.is_moderator
|
refute user.is_moderator
|
||||||
refute user.locked
|
refute user.locked
|
||||||
refute user.is_admin
|
refute user.is_admin
|
||||||
|
assert user.confirmation_pending
|
||||||
end
|
end
|
||||||
|
|
||||||
test "no user to set status" do
|
test "no user to set status" do
|
||||||
|
|
Loading…
Reference in a new issue