mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
you know what, let's make tests pass
This commit is contained in:
parent
2edc80bd7c
commit
2bf13011cc
6 changed files with 20 additions and 20 deletions
|
@ -27,7 +27,7 @@ defmodule PhilomenaWeb.ConfirmationControllerTest do
|
|||
})
|
||||
|
||||
assert redirected_to(conn) == "/"
|
||||
assert Flash.get(conn.assigns.flash, :info) =~ "If your email is in our system"
|
||||
assert Flash.get(conn.assigns.flash, :alert) =~ "If your email is in our system"
|
||||
assert Repo.get_by!(Users.UserToken, user_id: user.id).context == "confirm"
|
||||
end
|
||||
|
||||
|
@ -40,7 +40,7 @@ defmodule PhilomenaWeb.ConfirmationControllerTest do
|
|||
})
|
||||
|
||||
assert redirected_to(conn) == "/"
|
||||
assert Flash.get(conn.assigns.flash, :info) =~ "If your email is in our system"
|
||||
assert Flash.get(conn.assigns.flash, :alert) =~ "If your email is in our system"
|
||||
refute Repo.get_by(Users.UserToken, user_id: user.id)
|
||||
end
|
||||
|
||||
|
@ -51,7 +51,7 @@ defmodule PhilomenaWeb.ConfirmationControllerTest do
|
|||
})
|
||||
|
||||
assert redirected_to(conn) == "/"
|
||||
assert Flash.get(conn.assigns.flash, :info) =~ "If your email is in our system"
|
||||
assert Flash.get(conn.assigns.flash, :alert) =~ "If your email is in our system"
|
||||
assert Repo.all(Users.UserToken) == []
|
||||
end
|
||||
end
|
||||
|
@ -73,7 +73,7 @@ defmodule PhilomenaWeb.ConfirmationControllerTest do
|
|||
conn = get(conn, ~p"/confirmations/#{token}")
|
||||
assert redirected_to(conn) == "/"
|
||||
|
||||
assert Flash.get(conn.assigns.flash, :error) =~
|
||||
assert Flash.get(conn.assigns.flash, :warning) =~
|
||||
"Confirmation link is invalid or it has expired"
|
||||
end
|
||||
|
||||
|
@ -81,7 +81,7 @@ defmodule PhilomenaWeb.ConfirmationControllerTest do
|
|||
conn = get(conn, ~p"/confirmations/oops")
|
||||
assert redirected_to(conn) == "/"
|
||||
|
||||
assert Flash.get(conn.assigns.flash, :error) =~
|
||||
assert Flash.get(conn.assigns.flash, :warning) =~
|
||||
"Confirmation link is invalid or it has expired"
|
||||
|
||||
refute Users.get_user!(user.id).confirmed_at
|
||||
|
|
|
@ -26,7 +26,7 @@ defmodule PhilomenaWeb.PasswordControllerTest do
|
|||
})
|
||||
|
||||
assert redirected_to(conn) == "/"
|
||||
assert Flash.get(conn.assigns.flash, :info) =~ "If your email is in our system"
|
||||
assert Flash.get(conn.assigns.flash, :alert) =~ "If your email is in our system"
|
||||
assert Repo.get_by!(Users.UserToken, user_id: user.id).context == "reset_password"
|
||||
end
|
||||
|
||||
|
@ -37,7 +37,7 @@ defmodule PhilomenaWeb.PasswordControllerTest do
|
|||
})
|
||||
|
||||
assert redirected_to(conn) == "/"
|
||||
assert Flash.get(conn.assigns.flash, :info) =~ "If your email is in our system"
|
||||
assert Flash.get(conn.assigns.flash, :alert) =~ "If your email is in our system"
|
||||
assert Repo.all(Users.UserToken) == []
|
||||
end
|
||||
end
|
||||
|
@ -61,7 +61,7 @@ defmodule PhilomenaWeb.PasswordControllerTest do
|
|||
conn = get(conn, ~p"/passwords/oops/edit")
|
||||
assert redirected_to(conn) == "/"
|
||||
|
||||
assert Flash.get(conn.assigns.flash, :error) =~
|
||||
assert Flash.get(conn.assigns.flash, :warning) =~
|
||||
"Reset password link is invalid or it has expired"
|
||||
end
|
||||
end
|
||||
|
@ -109,7 +109,7 @@ defmodule PhilomenaWeb.PasswordControllerTest do
|
|||
conn = put(conn, ~p"/passwords/oops")
|
||||
assert redirected_to(conn) == "/"
|
||||
|
||||
assert Flash.get(conn.assigns.flash, :error) =~
|
||||
assert Flash.get(conn.assigns.flash, :warning) =~
|
||||
"Reset password link is invalid or it has expired"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,7 +17,7 @@ defmodule PhilomenaWeb.Registration.EmailControllerTest do
|
|||
})
|
||||
|
||||
assert redirected_to(conn) == ~p"/registrations/edit"
|
||||
assert Flash.get(conn.assigns.flash, :info) =~ "A link to confirm your email"
|
||||
assert Flash.get(conn.assigns.flash, :alert) =~ "A link to confirm your email"
|
||||
assert Users.get_user_by_email(user.email)
|
||||
end
|
||||
|
||||
|
@ -54,7 +54,7 @@ defmodule PhilomenaWeb.Registration.EmailControllerTest do
|
|||
conn = get(conn, ~p"/registrations/email/#{token}")
|
||||
assert redirected_to(conn) == ~p"/registrations/edit"
|
||||
|
||||
assert Flash.get(conn.assigns.flash, :error) =~
|
||||
assert Flash.get(conn.assigns.flash, :warning) =~
|
||||
"Email change link is invalid or it has expired"
|
||||
end
|
||||
|
||||
|
@ -62,7 +62,7 @@ defmodule PhilomenaWeb.Registration.EmailControllerTest do
|
|||
conn = get(conn, ~p"/registrations/email/oops")
|
||||
assert redirected_to(conn) == ~p"/registrations/edit"
|
||||
|
||||
assert Flash.get(conn.assigns.flash, :error) =~
|
||||
assert Flash.get(conn.assigns.flash, :warning) =~
|
||||
"Email change link is invalid or it has expired"
|
||||
|
||||
assert Users.get_user_by_email(user.email)
|
||||
|
|
|
@ -33,8 +33,8 @@ defmodule PhilomenaWeb.SessionControllerTest do
|
|||
conn = get(conn, "/registrations/edit")
|
||||
response = html_response(conn, 200)
|
||||
assert response =~ user.email
|
||||
assert response =~ "Settings</a>"
|
||||
assert response =~ "Logout</a>"
|
||||
assert response =~ "Settings</div>"
|
||||
assert response =~ "Logout</div>"
|
||||
end
|
||||
|
||||
test "logs the user in with remember me", %{conn: conn, user: user} do
|
||||
|
|
|
@ -27,7 +27,7 @@ defmodule PhilomenaWeb.UnlockControllerTest do
|
|||
})
|
||||
|
||||
assert redirected_to(conn) == "/"
|
||||
assert Flash.get(conn.assigns.flash, :info) =~ "If your email is in our system"
|
||||
assert Flash.get(conn.assigns.flash, :alert) =~ "If your email is in our system"
|
||||
assert Repo.get_by!(Users.UserToken, user_id: user.id).context == "unlock"
|
||||
end
|
||||
|
||||
|
@ -40,7 +40,7 @@ defmodule PhilomenaWeb.UnlockControllerTest do
|
|||
})
|
||||
|
||||
assert redirected_to(conn) == "/"
|
||||
assert Flash.get(conn.assigns.flash, :info) =~ "If your email is in our system"
|
||||
assert Flash.get(conn.assigns.flash, :alert) =~ "If your email is in our system"
|
||||
refute Repo.get_by(Users.UserToken, user_id: user.id)
|
||||
end
|
||||
|
||||
|
@ -51,7 +51,7 @@ defmodule PhilomenaWeb.UnlockControllerTest do
|
|||
})
|
||||
|
||||
assert redirected_to(conn) == "/"
|
||||
assert Flash.get(conn.assigns.flash, :info) =~ "If your email is in our system"
|
||||
assert Flash.get(conn.assigns.flash, :alert) =~ "If your email is in our system"
|
||||
assert Repo.all(Users.UserToken) == []
|
||||
end
|
||||
end
|
||||
|
@ -72,13 +72,13 @@ defmodule PhilomenaWeb.UnlockControllerTest do
|
|||
|
||||
conn = get(conn, ~p"/unlocks/#{token}")
|
||||
assert redirected_to(conn) == "/"
|
||||
assert Flash.get(conn.assigns.flash, :error) =~ "Unlock link is invalid or it has expired"
|
||||
assert Flash.get(conn.assigns.flash, :warning) =~ "Unlock link is invalid or it has expired"
|
||||
end
|
||||
|
||||
test "does not unlock with invalid token", %{conn: conn, user: user} do
|
||||
conn = get(conn, ~p"/unlocks/oops")
|
||||
assert redirected_to(conn) == "/"
|
||||
assert Flash.get(conn.assigns.flash, :error) =~ "Unlock link is invalid or it has expired"
|
||||
assert Flash.get(conn.assigns.flash, :warning) =~ "Unlock link is invalid or it has expired"
|
||||
assert Users.get_user!(user.id).locked_at
|
||||
end
|
||||
end
|
||||
|
|
|
@ -164,7 +164,7 @@ defmodule PhilomenaWeb.UserAuthTest do
|
|||
assert conn.halted
|
||||
assert redirected_to(conn) == ~p"/sessions/new"
|
||||
|
||||
assert Phoenix.Flash.get(conn.assigns.flash, :error) ==
|
||||
assert Phoenix.Flash.get(conn.assigns.flash, :warning) ==
|
||||
"You must log in to access this page."
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue