Refactor the ActivityPub module

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-04-22 12:17:56 +02:00
parent 17a6a6eada
commit 280f461ba7
32 changed files with 385 additions and 332 deletions

View File

@@ -12,14 +12,15 @@ defmodule Mobilizon.GraphQL.API.SearchTest do
alias Mobilizon.GraphQL.API.Search
alias Mobilizon.Federation.ActivityPub
alias Mobilizon.Federation.ActivityPub.Actor, as: ActivityPubActor
test "search an user by username" do
with_mock ActivityPub,
with_mock ActivityPubActor,
find_or_make_actor_from_nickname: fn "toto@domain.tld" -> {:ok, %Actor{id: 42}} end do
assert {:ok, %Page{total: 1, elements: [%Actor{id: 42}]}} ==
Search.search_actors(%{term: "toto@domain.tld"}, 1, 10, :Person)
assert_called(ActivityPub.find_or_make_actor_from_nickname("toto@domain.tld"))
assert_called(ActivityPubActor.find_or_make_actor_from_nickname("toto@domain.tld"))
end
end