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

@@ -5,7 +5,13 @@ defmodule MobilizonWeb.Resolvers.EventResolverTest do
alias MobilizonWeb.AbsintheHelpers
import Mobilizon.Factory
@event %{description: "some body", title: "some title", begins_on: Ecto.DateTime.utc()}
@event %{
description: "some body",
title: "some title",
begins_on: Ecto.DateTime.utc(),
uuid: "b5126423-f1af-43e4-a923-002a03003ba4",
url: "some url"
}
setup %{conn: conn} do
{:ok, %User{default_actor: %Actor{} = actor} = user} =
@@ -117,7 +123,7 @@ defmodule MobilizonWeb.Resolvers.EventResolverTest do
title: "come to my event",
description: "it will be fine",
begins_on: "#{DateTime.utc_now() |> DateTime.to_iso8601()}",
organizer_actor_username: "#{actor.preferred_username}",
organizer_actor_id: "#{actor.id}",
category: "#{category.title}"
) {
title,
@@ -131,6 +137,8 @@ defmodule MobilizonWeb.Resolvers.EventResolverTest do
|> auth_conn(user)
|> post("/api", AbsintheHelpers.mutation_skeleton(mutation))
require Logger
Logger.error(inspect(json_response(res, 200)))
assert json_response(res, 200)["data"]["createEvent"]["title"] == "come to my event"
end

View File

@@ -336,7 +336,8 @@ defmodule MobilizonWeb.Resolvers.UserResolverTest do
context.conn
|> post("/api", AbsintheHelpers.mutation_skeleton(mutation))
assert hd(json_response(res, 200)["errors"])["message"] == "password_too_short"
assert hd(json_response(res, 200)["errors"])["message"] ==
"The password you have choosen is too short. Please make sure your password contains at least 6 charaters."
end
test "test reset_password/3 with an invalid token", context do
@@ -361,7 +362,8 @@ defmodule MobilizonWeb.Resolvers.UserResolverTest do
context.conn
|> post("/api", AbsintheHelpers.mutation_skeleton(mutation))
assert hd(json_response(res, 200)["errors"])["message"] == "invalid_token"
assert hd(json_response(res, 200)["errors"])["message"] ==
"The token you provided is invalid. Make sure that the URL is exactly the one provided inside the email you got."
end
end
@@ -431,7 +433,8 @@ defmodule MobilizonWeb.Resolvers.UserResolverTest do
context.conn
|> post("/api", AbsintheHelpers.mutation_skeleton(mutation))
assert hd(json_response(res, 200)["errors"])["message"] == "Impossible to authenticate"
assert hd(json_response(res, 200)["errors"])["message"] ==
"Impossible to authenticate, either your email or password are invalid."
end
test "test login_user/3 with invalid email", context do