Make tests great again !

(Also use only one field for public/private key pem)
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2018-06-14 17:25:55 +02:00
parent 32596c3624
commit ca36dd12e2
43 changed files with 498 additions and 656 deletions

View File

@@ -152,10 +152,11 @@ defmodule Eventos.Events do
"""
def create_event(attrs \\ %{}) do
%Event{}
|> Event.changeset(attrs)
|> Repo.insert!()
|> Repo.preload([:organizer_actor])
case %Event{} |> Event.changeset(attrs) |> Repo.insert() do
{:ok, %Event{} = event} -> {:ok, Repo.preload(event, [:organizer_actor])}
err -> err
end
end
@doc """
@@ -522,8 +523,13 @@ defmodule Eventos.Events do
@doc """
Returns the list of sessions for an event
"""
def list_sessions_for_event(event_id) do
Repo.all(from s in Session, where: s.event_id == ^event_id)
def list_sessions_for_event(event_uuid) do
Repo.all(
from s in Session,
join: e in Event,
on: s.event_id == e.id,
where: e.uuid == ^event_uuid
)
end
@doc """
@@ -741,6 +747,8 @@ defmodule Eventos.Events do
"""
def get_comment!(id), do: Repo.get!(Comment, id)
def get_comment_with_uuid!(uuid), do: Repo.get_by!(Comment, uuid: uuid)
@doc """
Creates a comment.