logo

pleroma

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

event_handling_test.exs (1494B)


  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.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. headers: HttpRequestMock.activitypub_object_headers()
  15. }
  16. %{url: "https://mobilizon.org/@tcit"} ->
  17. %Tesla.Env{
  18. status: 200,
  19. body: File.read!("test/fixtures/tesla_mock/mobilizon.org-user.json"),
  20. headers: HttpRequestMock.activitypub_object_headers()
  21. }
  22. end)
  23. assert {:ok, object} =
  24. Fetcher.fetch_object_from_id(
  25. "https://mobilizon.org/events/252d5816-00a3-4a89-a66f-15bf65c33e39"
  26. )
  27. assert object.data["to"] == ["https://www.w3.org/ns/activitystreams#Public"]
  28. assert object.data["cc"] == ["https://mobilizon.org/@tcit/followers"]
  29. assert object.data["url"] ==
  30. "https://mobilizon.org/events/252d5816-00a3-4a89-a66f-15bf65c33e39"
  31. assert object.data["published"] == "2019-12-17T11:33:56Z"
  32. assert object.data["name"] == "Mobilizon Launching Party"
  33. end
  34. end