1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Repo.Migrations.ConfirmLoggedInUsersTest do
8 use Pleroma.DataCase, async: true
10 import Pleroma.Factory
11 import Pleroma.Tests.Helpers
13 setup_all do: require_migration("20201231185546_confirm_logged_in_users")
15 test "up/0 confirms unconfirmed but previously-logged-in users", %{migration: migration} do
16 insert_list(25, :oauth_token)
17 Repo.update_all(User, set: [confirmation_pending: true])
18 insert_list(5, :user, confirmation_pending: true)
22 |> where(confirmation_pending: true)
23 |> Repo.aggregate(:count)
27 assert {25, nil} == migration.up()
31 |> where(confirmation_pending: true)
32 |> Repo.aggregate(:count)
37 test "down/0 does nothing", %{migration: migration} do
38 assert :noop == migration.down()