logo

pleroma

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

event_handling_test.exs (1364B)


  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.ActivityPub.Transmogrifier.EventHandlingTest do
  5. use Oban.Testing, repo: Pleroma.Repo
  6. use Pleroma.DataCase
  7. alias Pleroma.Object.Fetcher
  8. test "Mobilizon Event object" do
  9. Tesla.Mock.mock(fn
  10. %{url: "https://mobilizon.org/events/252d5816-00a3-4a89-a66f-15bf65c33e39"} ->
  11. %Tesla.Env{
  12. status: 200,
  13. body: File.read!("test/fixtures/tesla_mock/mobilizon.org-event.json")
  14. }
  15. %{url: "https://mobilizon.org/@tcit"} ->
  16. %Tesla.Env{
  17. status: 200,
  18. body: File.read!("test/fixtures/tesla_mock/mobilizon.org-user.json")
  19. }
  20. end)
  21. assert {:ok, object} =
  22. Fetcher.fetch_object_from_id(
  23. "https://mobilizon.org/events/252d5816-00a3-4a89-a66f-15bf65c33e39"
  24. )
  25. assert object.data["to"] == ["https://www.w3.org/ns/activitystreams#Public"]
  26. assert object.data["cc"] == ["https://mobilizon.org/@tcit/followers"]
  27. assert object.data["url"] ==
  28. "https://mobilizon.org/events/252d5816-00a3-4a89-a66f-15bf65c33e39"
  29. assert object.data["published"] == "2019-12-17T11:33:56Z"
  30. assert object.data["name"] == "Mobilizon Launching Party"
  31. end
  32. end