Federate participations

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-08-14 17:45:11 +02:00
parent b8daf87dd9
commit 641129dc74
18 changed files with 752 additions and 123 deletions

View File

@@ -116,7 +116,8 @@ defmodule MobilizonWeb.Resolvers.ParticipantResolverTest do
|> auth_conn(user)
|> post("/api", AbsintheHelpers.mutation_skeleton(mutation))
assert hd(json_response(res, 200)["errors"])["message"] =~ "Event id not found"
assert hd(json_response(res, 200)["errors"])["message"] ==
"Event with this ID 1042 doesn't exist"
end
test "actor_leave_event/3 should delete a participant from an event", %{
@@ -290,13 +291,14 @@ defmodule MobilizonWeb.Resolvers.ParticipantResolverTest do
user: user,
actor: actor
} do
event = insert(:event)
participant = insert(:participant, %{actor: actor})
mutation = """
mutation {
leaveEvent(
actor_id: #{participant.actor.id},
event_id: 1042
event_id: #{event.id}
) {
actor {
id
@@ -355,13 +357,13 @@ defmodule MobilizonWeb.Resolvers.ParticipantResolverTest do
|> get("/api", AbsintheHelpers.query_skeleton(query, "participants"))
assert json_response(res, 200)["data"]["participants"] == [
%{
"actor" => %{"preferredUsername" => context.actor.preferred_username},
"role" => "creator"
},
%{
"actor" => %{"preferredUsername" => participant2.actor.preferred_username},
"role" => "participant"
},
%{
"actor" => %{"preferredUsername" => context.actor.preferred_username},
"role" => "creator"
}
]
end