logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

user_test.exs (925B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Web.Preload.Providers.UserTest do
  5. use Pleroma.DataCase
  6. import Pleroma.Factory
  7. alias Pleroma.Web.Preload.Providers.User
  8. describe "returns empty when user doesn't exist" do
  9. test "nil user specified" do
  10. assert User.generate_terms(%{user: nil}) == %{}
  11. end
  12. test "missing user specified" do
  13. assert User.generate_terms(%{user: :not_a_user}) == %{}
  14. end
  15. end
  16. describe "specified user exists" do
  17. setup do
  18. user = insert(:user)
  19. terms = User.generate_terms(%{user: user})
  20. %{terms: terms, user: user}
  21. end
  22. test "account is rendered", %{terms: terms, user: user} do
  23. account = terms["/api/v1/accounts/#{user.id}"]
  24. assert %{acct: user, username: user} = account
  25. end
  26. end
  27. end