Allow to refresh instance outbox when they accept subscription
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -7,6 +7,7 @@ defmodule Mobilizon.Federation.ActivityPub.TransmogrifierTest do
|
||||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
||||
|
||||
use Mobilizon.DataCase
|
||||
use Oban.Testing, repo: Mobilizon.Storage.Repo
|
||||
|
||||
import Mobilizon.Factory
|
||||
import ExUnit.CaptureLog
|
||||
@@ -738,7 +739,16 @@ defmodule Mobilizon.Federation.ActivityPub.TransmogrifierTest do
|
||||
use_cassette "activity_pub/event_update_activities" do
|
||||
data = File.read!("test/fixtures/mobilizon-post-activity.json") |> Jason.decode!()
|
||||
|
||||
{:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data)
|
||||
{:ok, %Activity{data: data, local: false}, %Event{id: event_id}} =
|
||||
Transmogrifier.handle_incoming(data)
|
||||
|
||||
assert_enqueued(
|
||||
worker: Mobilizon.Service.Workers.BuildSearch,
|
||||
args: %{event_id: event_id, op: :insert_search_event}
|
||||
)
|
||||
|
||||
assert %{success: 1, failure: 0} == Oban.drain_queue(queue: :search)
|
||||
|
||||
update_data = File.read!("test/fixtures/mastodon-update.json") |> Jason.decode!()
|
||||
|
||||
object =
|
||||
@@ -757,6 +767,14 @@ defmodule Mobilizon.Federation.ActivityPub.TransmogrifierTest do
|
||||
Transmogrifier.handle_incoming(update_data)
|
||||
|
||||
%Event{} = event = Events.get_event_by_url(data["object"]["id"])
|
||||
|
||||
assert_enqueued(
|
||||
worker: Mobilizon.Service.Workers.BuildSearch,
|
||||
args: %{event_id: event_id, op: :update_search_event}
|
||||
)
|
||||
|
||||
assert %{success: 1, failure: 0} == Oban.drain_queue(queue: :search)
|
||||
|
||||
assert event.title == "My updated event"
|
||||
|
||||
assert event.description == data["object"]["content"]
|
||||
|
||||
@@ -143,8 +143,10 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
|
||||
conn
|
||||
|> get(Actor.build_url(actor.preferred_username, :outbox))
|
||||
|
||||
assert json_response(conn, 200)["totalItems"] == 1
|
||||
assert json_response(conn, 200)["first"]["orderedItems"] == [comment.url]
|
||||
assert res = json_response(conn, 200)
|
||||
|
||||
assert res["totalItems"] == 1
|
||||
assert res["first"]["orderedItems"] |> Enum.map(& &1["object"]["id"]) == [comment.url]
|
||||
end
|
||||
|
||||
test "it returns an event activity in a collection", %{conn: conn} do
|
||||
@@ -155,8 +157,10 @@ defmodule Mobilizon.Web.ActivityPubControllerTest do
|
||||
conn
|
||||
|> get(Actor.build_url(actor.preferred_username, :outbox))
|
||||
|
||||
assert json_response(conn, 200)["totalItems"] == 1
|
||||
assert json_response(conn, 200)["first"]["orderedItems"] == [event.url]
|
||||
assert res = json_response(conn, 200)
|
||||
|
||||
assert res["totalItems"] == 1
|
||||
assert res["first"]["orderedItems"] |> Enum.map(& &1["object"]["id"]) == [event.url]
|
||||
end
|
||||
|
||||
test "it works for more than 10 events", %{conn: conn} do
|
||||
|
||||
Reference in New Issue
Block a user