logo

pleroma

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

suggestion_view_test.exs (1073B)


  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.Web.MastodonAPI.SuggestionViewTest do
  5. use Pleroma.DataCase, async: true
  6. import Pleroma.Factory
  7. alias Pleroma.Web.MastodonAPI.SuggestionView, as: View
  8. test "show.json" do
  9. user = insert(:user, is_suggested: true)
  10. json = View.render("show.json", %{user: user, source: :staff, skip_visibility_check: true})
  11. assert json.source == :staff
  12. assert json.account.id == user.id
  13. end
  14. test "index.json" do
  15. user1 = insert(:user, is_suggested: true)
  16. user2 = insert(:user, is_suggested: true)
  17. user3 = insert(:user, is_suggested: true)
  18. [suggestion1, suggestion2, suggestion3] =
  19. View.render("index.json", %{
  20. users: [user1, user2, user3],
  21. source: :staff,
  22. skip_visibility_check: true
  23. })
  24. assert suggestion1.source == :staff
  25. assert suggestion2.account.id == user2.id
  26. assert suggestion3.account.url == user3.ap_id
  27. end
  28. end