Fix tests

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-01-24 15:23:27 +01:00
parent 617b59c038
commit c660210439
9 changed files with 34 additions and 22 deletions

View File

@@ -69,14 +69,14 @@ defmodule Mobilizon.ActorsTest do
assert actor_id == Actors.get_actor_for_user(user).id
end
test "get_actor_with_everything!/1 returns the actor with it's organized events", %{
test "get_actor_with_everything/1 returns the actor with it's organized events", %{
actor: actor
} do
assert Actors.get_actor_with_everything!(actor.id).organized_events == []
assert Actors.get_actor_with_everything(actor.id).organized_events == []
event = insert(:event, organizer_actor: actor)
event_found_id =
Actors.get_actor_with_everything!(actor.id).organized_events |> hd |> Map.get(:id)
Actors.get_actor_with_everything(actor.id).organized_events |> hd |> Map.get(:id)
assert event_found_id == event.id
end
@@ -573,15 +573,15 @@ defmodule Mobilizon.ActorsTest do
test "follow/3 makes an actor follow another", %{actor: actor, target_actor: target_actor} do
# Preloading followers/followings
actor = Actors.get_actor_with_everything!(actor.id)
target_actor = Actors.get_actor_with_everything!(target_actor.id)
actor = Actors.get_actor_with_everything(actor.id)
target_actor = Actors.get_actor_with_everything(target_actor.id)
{:ok, follower} = Actor.follow(target_actor, actor)
assert follower.actor.id == actor.id
# Referesh followers/followings
actor = Actors.get_actor_with_everything!(actor.id)
target_actor = Actors.get_actor_with_everything!(target_actor.id)
actor = Actors.get_actor_with_everything(actor.id)
target_actor = Actors.get_actor_with_everything(target_actor.id)
assert target_actor.followers |> Enum.map(& &1.actor_id) == [actor.id]
assert actor.followings |> Enum.map(& &1.target_actor_id) == [target_actor.id]

View File

@@ -9,7 +9,9 @@ defmodule Mobilizon.EventsTest do
begins_on: "2010-04-17 14:00:00.000000Z",
description: "some description",
ends_on: "2010-04-17 14:00:00.000000Z",
title: "some title"
title: "some title",
url: "some url",
uuid: "b5126423-f1af-43e4-a923-002a03003ba4"
}
describe "events" do

View File

@@ -176,7 +176,7 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
assert data["type"] == "Follow"
assert data["id"] == "https://social.tcit.fr/users/tcit#follows/2"
actor = Actors.get_actor_with_everything!(actor.id)
actor = Actors.get_actor_with_everything(actor.id)
assert Actor.following?(Actors.get_actor_by_url!(data["actor"], true), actor)
end