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

@@ -2,7 +2,7 @@ defmodule EventosWeb.BotController do
use EventosWeb, :controller
alias Eventos.Actors
alias Eventos.Actors.Bot
alias Eventos.Actors.{Bot, Actor}
action_fallback EventosWeb.FallbackController
@@ -12,9 +12,9 @@ defmodule EventosWeb.BotController do
end
def create(conn, %{"bot" => bot_params}) do
with user <- Guardian.Plug.current_resource,
with user <- Guardian.Plug.current_resource(conn),
bot_params <- Map.put(bot_params, "user_id", user.id),
{:ok, actor} <- Actors.register_bot_account(%{name: bot_params["name"], summary: bot_params["summary"]}),
%Actor{} = actor <- Actors.register_bot_account(%{name: bot_params["name"], summary: bot_params["summary"]}),
bot_params <- Map.put(bot_params, "actor_id", actor.id),
{:ok, %Bot{} = bot} <- Actors.create_bot(bot_params) do
conn