logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

confirm_logged_in_users_test.exs (1064B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Repo.Migrations.ConfirmLoggedInUsersTest do
  5. alias Pleroma.Repo
  6. alias Pleroma.User
  7. use Pleroma.DataCase, async: true
  8. import Ecto.Query
  9. import Pleroma.Factory
  10. import Pleroma.Tests.Helpers
  11. setup_all do: require_migration("20201231185546_confirm_logged_in_users")
  12. test "up/0 confirms unconfirmed but previously-logged-in users", %{migration: migration} do
  13. insert_list(25, :oauth_token)
  14. Repo.update_all(User, set: [is_confirmed: false])
  15. insert_list(5, :user, is_confirmed: false)
  16. count =
  17. User
  18. |> where(is_confirmed: false)
  19. |> Repo.aggregate(:count)
  20. assert count == 30
  21. assert {25, nil} == migration.up()
  22. count =
  23. User
  24. |> where(is_confirmed: false)
  25. |> Repo.aggregate(:count)
  26. assert count == 5
  27. end
  28. test "down/0 does nothing", %{migration: migration} do
  29. assert :noop == migration.down()
  30. end
  31. end