Remove toggle_confirmation; require explicit state change
Also cosmetic changes to make the code clearer
This commit is contained in:
parent
d36182c088
commit
2c0fe2ea9e
11 changed files with 37 additions and 41 deletions
|
|
@ -14,12 +14,12 @@ defmodule Pleroma.Repo.Migrations.ConfirmLoggedInUsersTest do
|
|||
|
||||
test "up/0 confirms unconfirmed but previously-logged-in users", %{migration: migration} do
|
||||
insert_list(25, :oauth_token)
|
||||
Repo.update_all(User, set: [confirmation_pending: true])
|
||||
insert_list(5, :user, confirmation_pending: true)
|
||||
Repo.update_all(User, set: [is_confirmed: false])
|
||||
insert_list(5, :user, is_confirmed: false)
|
||||
|
||||
count =
|
||||
User
|
||||
|> where(confirmation_pending: true)
|
||||
|> where(is_confirmed: false)
|
||||
|> Repo.aggregate(:count)
|
||||
|
||||
assert count == 30
|
||||
|
|
@ -28,7 +28,7 @@ defmodule Pleroma.Repo.Migrations.ConfirmLoggedInUsersTest do
|
|||
|
||||
count =
|
||||
User
|
||||
|> where(confirmation_pending: true)
|
||||
|> where(is_confirmed: false)
|
||||
|> Repo.aggregate(:count)
|
||||
|
||||
assert count == 5
|
||||
|
|
|
|||
|
|
@ -666,7 +666,7 @@ defmodule Pleroma.UserTest do
|
|||
end
|
||||
|
||||
test "it creates confirmed user if :confirmed option is given" do
|
||||
changeset = User.register_changeset(%User{}, @full_user_data, need_confirmation: false)
|
||||
changeset = User.register_changeset(%User{}, @full_user_data, confirmed: true)
|
||||
assert changeset.valid?
|
||||
|
||||
{:ok, user} = Repo.insert(changeset)
|
||||
|
|
|
|||
|
|
@ -906,8 +906,11 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
|
|||
|
||||
assert ret_conn.status == 200
|
||||
|
||||
assert User.get_by_id(first_user.id).is_confirmed
|
||||
assert User.get_by_id(second_user.id).is_confirmed
|
||||
first_user = User.get_by_id(first_user.id)
|
||||
second_user = User.get_by_id(second_user.id)
|
||||
|
||||
assert first_user.is_confirmed
|
||||
assert second_user.is_confirmed
|
||||
|
||||
log_entry = Repo.one(ModerationLog)
|
||||
|
||||
|
|
|
|||
|
|
@ -928,7 +928,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
|
|||
|
||||
{:ok, user} =
|
||||
insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password))
|
||||
|> User.confirmation_changeset(need_confirmation: true)
|
||||
|> User.confirmation_changeset(set_confirmation: false)
|
||||
|> User.update_and_set_cache()
|
||||
|
||||
refute Pleroma.User.account_status(user) == :active
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do
|
|||
setup do
|
||||
{:ok, user} =
|
||||
insert(:user)
|
||||
|> User.confirmation_changeset(need_confirmation: true)
|
||||
|> User.confirmation_changeset(set_confirmation: false)
|
||||
|> User.update_and_set_cache()
|
||||
|
||||
refute user.is_confirmed
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
|
|||
setup do
|
||||
{:ok, user} =
|
||||
insert(:user)
|
||||
|> User.confirmation_changeset(need_confirmation: true)
|
||||
|> User.confirmation_changeset(set_confirmation: false)
|
||||
|> Repo.update()
|
||||
|
||||
refute user.is_confirmed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue