Replace User.toggle_confirmation/1 with User.confirm/1, fixes #2235
This commit is contained in:
parent
c3112fd13a
commit
dc38dc8472
7 changed files with 13 additions and 42 deletions
|
|
@ -457,24 +457,24 @@ defmodule Mix.Tasks.Pleroma.UserTest do
|
|||
end
|
||||
end
|
||||
|
||||
describe "running toggle_confirmed" do
|
||||
describe "running confirm" do
|
||||
test "user is confirmed" do
|
||||
%{id: id, nickname: nickname} = insert(:user, confirmation_pending: false)
|
||||
|
||||
assert :ok = Mix.Tasks.Pleroma.User.run(["toggle_confirmed", nickname])
|
||||
assert :ok = Mix.Tasks.Pleroma.User.run(["confirm", nickname])
|
||||
assert_received {:mix_shell, :info, [message]}
|
||||
assert message == "#{nickname} needs confirmation."
|
||||
assert message == "#{nickname} doesn't need confirmation."
|
||||
|
||||
user = Repo.get(User, id)
|
||||
assert user.confirmation_pending
|
||||
assert user.confirmation_token
|
||||
refute user.confirmation_pending
|
||||
refute user.confirmation_token
|
||||
end
|
||||
|
||||
test "user is not confirmed" do
|
||||
%{id: id, nickname: nickname} =
|
||||
insert(:user, confirmation_pending: true, confirmation_token: "some token")
|
||||
|
||||
assert :ok = Mix.Tasks.Pleroma.User.run(["toggle_confirmed", nickname])
|
||||
assert :ok = Mix.Tasks.Pleroma.User.run(["confirm", nickname])
|
||||
assert_received {:mix_shell, :info, [message]}
|
||||
assert message == "#{nickname} doesn't need confirmation."
|
||||
|
||||
|
|
@ -484,7 +484,7 @@ defmodule Mix.Tasks.Pleroma.UserTest do
|
|||
end
|
||||
|
||||
test "it prints an error message when user is not exist" do
|
||||
Mix.Tasks.Pleroma.User.run(["toggle_confirmed", "foo"])
|
||||
Mix.Tasks.Pleroma.User.run(["confirm", "foo"])
|
||||
|
||||
assert_received {:mix_shell, :error, [message]}
|
||||
assert message =~ "No local user"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue