diff options
author | Mark Felder <feld@FreeBSD.org> | 2019-05-16 13:11:17 -0500 |
---|---|---|
committer | Mark Felder <feld@FreeBSD.org> | 2019-05-16 13:11:17 -0500 |
commit | ebb04821161e4377f311af7192168e2c01e8c1bb (patch) | |
tree | 37995ccda7c4351653de56db4593b877a443fde0 /test/tasks/user_test.exs | |
parent | f168a1cbdc318ffaa2d8bc9fb561eb3dfdfb89d9 (diff) | |
parent | fde30aee43edd50a40dd4bfdc0008f5395dfc751 (diff) | |
download | pleroma-ebb04821161e4377f311af7192168e2c01e8c1bb.tar.gz pleroma-ebb04821161e4377f311af7192168e2c01e8c1bb.zip |
Merge branch 'develop' into conversations-import
Diffstat (limited to 'test/tasks/user_test.exs')
-rw-r--r-- | test/tasks/user_test.exs | 27 |
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 |