logo

pleroma

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

list_view_test.exs (865B)


  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.MastodonAPI.ListViewTest do
  5. use Pleroma.DataCase
  6. import Pleroma.Factory
  7. alias Pleroma.Web.MastodonAPI.ListView
  8. test "show" do
  9. user = insert(:user)
  10. title = "mortal enemies"
  11. {:ok, list} = Pleroma.List.create(title, user)
  12. expected = %{
  13. id: to_string(list.id),
  14. title: title
  15. }
  16. assert expected == ListView.render("show.json", %{list: list})
  17. end
  18. test "index" do
  19. user = insert(:user)
  20. {:ok, list} = Pleroma.List.create("my list", user)
  21. {:ok, list2} = Pleroma.List.create("cofe", user)
  22. assert [%{id: _, title: "my list"}, %{id: _, title: "cofe"}] =
  23. ListView.render("index.json", lists: [list, list2])
  24. end
  25. end