aboutsummaryrefslogtreecommitdiff
path: root/test/tasks/user_test.exs
diff options
context:
space:
mode:
authorAlexander Strizhakov <alex.strizhakov@gmail.com>2019-05-16 13:23:41 +0000
committerrinpatch <rinpatch@sdf.org>2019-05-16 13:23:41 +0000
commit73ae58fdfaf0b9dc9630929b0b84ae3b6083684a (patch)
tree568b4358d1c41516ac94c1173504d9ea77734444 /test/tasks/user_test.exs
parenta2771869a3b9851edea4961314c7944f3823f754 (diff)
downloadpleroma-73ae58fdfaf0b9dc9630929b0b84ae3b6083684a.tar.gz
Feature/896 toggling confirmation
Diffstat (limited to 'test/tasks/user_test.exs')
-rw-r--r--test/tasks/user_test.exs27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/tasks/user_test.exs b/test/tasks/user_test.exs
index eaf4ecf84..1f97740be 100644
--- a/test/tasks/user_test.exs
+++ b/test/tasks/user_test.exs
@@ -338,4 +338,31 @@ defmodule Mix.Tasks.Pleroma.UserTest do
assert message == "User #{nickname} statuses deleted."
end
end
+
+ describe "running toggle_confirmed" do
+ test "user is confirmed" do
+ %{id: id, nickname: nickname} = insert(:user, info: %{confirmation_pending: false})
+
+ assert :ok = Mix.Tasks.Pleroma.User.run(["toggle_confirmed", nickname])
+ assert_received {:mix_shell, :info, [message]}
+ assert message == "#{nickname} needs confirmation."
+
+ user = Repo.get(User, id)
+ assert user.info.confirmation_pending
+ assert user.info.confirmation_token
+ end
+
+ test "user is not confirmed" do
+ %{id: id, nickname: nickname} =
+ insert(:user, info: %{confirmation_pending: true, confirmation_token: "some token"})
+
+ assert :ok = Mix.Tasks.Pleroma.User.run(["toggle_confirmed", nickname])
+ assert_received {:mix_shell, :info, [message]}
+ assert message == "#{nickname} doesn't need confirmation."
+
+ user = Repo.get(User, id)
+ refute user.info.confirmation_pending
+ refute user.info.confirmation_token
+ end
+ end
end