upgrade to phoenix 1.7
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
14
test/memex_web/controllers/error_html_test.exs
Normal file
14
test/memex_web/controllers/error_html_test.exs
Normal file
@ -0,0 +1,14 @@
|
||||
defmodule MemexWeb.ErrorHTMLTest do
|
||||
use MemexWeb.ConnCase, async: true
|
||||
# Bring render_to_string/4 for testing custom views
|
||||
import Phoenix.Template
|
||||
alias MemexWeb.ErrorHTML
|
||||
|
||||
test "renders 404.html" do
|
||||
assert render_to_string(ErrorHTML, "404", "html", []) =~ "not found"
|
||||
end
|
||||
|
||||
test "renders 500.html" do
|
||||
assert render_to_string(ErrorHTML, "500", "html", []) =~ "internal server error"
|
||||
end
|
||||
end
|
12
test/memex_web/controllers/error_json_test.exs
Normal file
12
test/memex_web/controllers/error_json_test.exs
Normal file
@ -0,0 +1,12 @@
|
||||
defmodule MemexWeb.ErrorJSONTest do
|
||||
use MemexWeb.ConnCase, async: true
|
||||
alias MemexWeb.ErrorJSON
|
||||
|
||||
test "renders 404" do
|
||||
assert ErrorJSON.render("404.json", %{}) == %{errors: %{detail: "not found"}}
|
||||
end
|
||||
|
||||
test "renders 500" do
|
||||
assert ErrorJSON.render("500.json", %{}) == %{errors: %{detail: "internal server error"}}
|
||||
end
|
||||
end
|
@ -35,7 +35,7 @@ defmodule MemexWeb.ExportControllerTest do
|
||||
pipeline: pipeline,
|
||||
step: step
|
||||
} do
|
||||
conn = get(conn, Routes.export_path(conn, :export, :json))
|
||||
conn = get(conn, ~p"/export/json")
|
||||
|
||||
ideal_note = %{
|
||||
"slug" => note.slug,
|
||||
|
@ -1,14 +0,0 @@
|
||||
defmodule MemexWeb.HomeControllerTest do
|
||||
@moduledoc """
|
||||
Tests the home page
|
||||
"""
|
||||
|
||||
use MemexWeb.ConnCase
|
||||
|
||||
@moduletag :home_controller_test
|
||||
|
||||
test "GET /", %{conn: conn} do
|
||||
conn = get(conn, "/")
|
||||
assert html_response(conn, 200) =~ "memEx"
|
||||
end
|
||||
end
|
@ -143,9 +143,9 @@ defmodule MemexWeb.UserAuthTest do
|
||||
test "redirects if user is not authenticated", %{conn: conn} do
|
||||
conn = conn |> fetch_flash() |> UserAuth.require_authenticated_user([])
|
||||
assert conn.halted
|
||||
assert redirected_to(conn) == Routes.user_session_path(conn, :new)
|
||||
assert redirected_to(conn) == ~p"/users/log_in"
|
||||
|
||||
assert get_flash(conn, :error) ==
|
||||
assert conn.assigns.flash["error"] ==
|
||||
"You must confirm your account and log in to access this page."
|
||||
end
|
||||
|
||||
|
@ -14,7 +14,7 @@ defmodule MemexWeb.UserConfirmationControllerTest do
|
||||
|
||||
describe "GET /users/confirm" do
|
||||
test "renders the confirmation page", %{conn: conn} do
|
||||
conn = get(conn, Routes.user_confirmation_path(conn, :new))
|
||||
conn = get(conn, ~p"/users/confirm")
|
||||
response = html_response(conn, 200)
|
||||
assert response =~ "Resend confirmation instructions"
|
||||
end
|
||||
@ -24,14 +24,14 @@ defmodule MemexWeb.UserConfirmationControllerTest do
|
||||
@tag :capture_log
|
||||
test "sends a new confirmation token", %{conn: conn, user: user} do
|
||||
conn =
|
||||
post(conn, Routes.user_confirmation_path(conn, :create), %{
|
||||
post(conn, ~p"/users/confirm", %{
|
||||
user: %{email: user.email}
|
||||
})
|
||||
|
||||
assert redirected_to(conn) == "/"
|
||||
|
||||
assert get_flash(conn, :info) =~
|
||||
"If your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly."
|
||||
conn.assigns.flash["info"] =~
|
||||
"If your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly."
|
||||
|
||||
assert Repo.get_by!(Accounts.UserToken, user_id: user.id).context == "confirm"
|
||||
end
|
||||
@ -40,26 +40,26 @@ defmodule MemexWeb.UserConfirmationControllerTest do
|
||||
Repo.update!(Accounts.User.confirm_changeset(user))
|
||||
|
||||
conn =
|
||||
post(conn, Routes.user_confirmation_path(conn, :create), %{
|
||||
post(conn, ~p"/users/confirm", %{
|
||||
user: %{email: user.email}
|
||||
})
|
||||
|
||||
assert redirected_to(conn) == "/"
|
||||
|
||||
assert get_flash(conn, :info) =~
|
||||
"If your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly."
|
||||
conn.assigns.flash["info"] =~
|
||||
"If your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly."
|
||||
end
|
||||
|
||||
test "does not send confirmation token if email is invalid", %{conn: conn} do
|
||||
conn =
|
||||
post(conn, Routes.user_confirmation_path(conn, :create), %{
|
||||
post(conn, ~p"/users/confirm", %{
|
||||
user: %{email: "unknown@example.com"}
|
||||
})
|
||||
|
||||
assert redirected_to(conn) == "/"
|
||||
|
||||
assert get_flash(conn, :info) =~
|
||||
"If your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly."
|
||||
conn.assigns.flash["info"] =~
|
||||
"If your email is in our system and it has not been confirmed yet, you will receive an email with instructions shortly."
|
||||
|
||||
assert Repo.all(Accounts.UserToken) == []
|
||||
end
|
||||
@ -72,34 +72,34 @@ defmodule MemexWeb.UserConfirmationControllerTest do
|
||||
Accounts.deliver_user_confirmation_instructions(user, url)
|
||||
end)
|
||||
|
||||
conn = get(conn, Routes.user_confirmation_path(conn, :confirm, token))
|
||||
conn = get(conn, ~p"/users/confirm/#{token}")
|
||||
assert redirected_to(conn) == "/"
|
||||
|
||||
assert get_flash(conn, :info) =~ "#{user.email} confirmed successfully"
|
||||
conn.assigns.flash["info"] =~ "#{user.email} confirmed successfully"
|
||||
|
||||
assert Accounts.get_user!(user.id).confirmed_at
|
||||
refute get_session(conn, :user_token)
|
||||
assert Repo.all(Accounts.UserToken) == []
|
||||
|
||||
# When not logged in
|
||||
conn = get(conn, Routes.user_confirmation_path(conn, :confirm, token))
|
||||
conn = get(conn, ~p"/users/confirm/#{token}")
|
||||
assert redirected_to(conn) == "/"
|
||||
assert get_flash(conn, :error) =~ "User confirmation link is invalid or it has expired"
|
||||
conn.assigns.flash["error"] =~ "User confirmation link is invalid or it has expired"
|
||||
|
||||
# When logged in
|
||||
conn =
|
||||
build_conn()
|
||||
|> log_in_user(user)
|
||||
|> get(Routes.user_confirmation_path(conn, :confirm, token))
|
||||
|> get(~p"/users/confirm/#{token}")
|
||||
|
||||
assert redirected_to(conn) == "/"
|
||||
refute get_flash(conn, :error)
|
||||
refute conn.assigns.flash["error"]
|
||||
end
|
||||
|
||||
test "does not confirm email with invalid token", %{conn: conn, user: user} do
|
||||
conn = get(conn, Routes.user_confirmation_path(conn, :confirm, "oops"))
|
||||
conn = get(conn, ~p"/users/confirm/#{"oops"}")
|
||||
assert redirected_to(conn) == "/"
|
||||
assert get_flash(conn, :error) =~ "User confirmation link is invalid or it has expired"
|
||||
conn.assigns.flash["error"] =~ "User confirmation link is invalid or it has expired"
|
||||
|
||||
refute Accounts.get_user!(user.id).confirmed_at
|
||||
end
|
||||
|
@ -9,14 +9,14 @@ defmodule MemexWeb.UserRegistrationControllerTest do
|
||||
|
||||
describe "GET /users/register" do
|
||||
test "renders registration page", %{conn: conn} do
|
||||
conn = get(conn, Routes.user_registration_path(conn, :new))
|
||||
conn = get(conn, ~p"/users/register")
|
||||
response = html_response(conn, 200)
|
||||
assert response =~ "register"
|
||||
assert response =~ "log in"
|
||||
end
|
||||
|
||||
test "redirects if already logged in", %{conn: conn} do
|
||||
conn = conn |> log_in_user(user_fixture()) |> get(Routes.user_registration_path(conn, :new))
|
||||
conn = conn |> log_in_user(user_fixture()) |> get(~p"/users/register")
|
||||
assert redirected_to(conn) == "/"
|
||||
end
|
||||
end
|
||||
@ -27,7 +27,7 @@ defmodule MemexWeb.UserRegistrationControllerTest do
|
||||
email = unique_user_email()
|
||||
|
||||
conn =
|
||||
post(conn, Routes.user_registration_path(conn, :create), %{
|
||||
post(conn, ~p"/users/register", %{
|
||||
user: valid_user_attributes(email: email)
|
||||
})
|
||||
|
||||
@ -40,7 +40,7 @@ defmodule MemexWeb.UserRegistrationControllerTest do
|
||||
|
||||
test "render errors for invalid data", %{conn: conn} do
|
||||
conn =
|
||||
post(conn, Routes.user_registration_path(conn, :create), %{
|
||||
post(conn, ~p"/users/register", %{
|
||||
user: %{email: "with spaces", password: "too short"}
|
||||
})
|
||||
|
||||
|
@ -14,7 +14,7 @@ defmodule MemexWeb.UserResetPasswordControllerTest do
|
||||
|
||||
describe "GET /users/reset_password" do
|
||||
test "renders the reset password page", %{conn: conn} do
|
||||
conn = get(conn, Routes.user_reset_password_path(conn, :new))
|
||||
conn = get(conn, ~p"/users/reset_password")
|
||||
response = html_response(conn, 200)
|
||||
assert response =~ "forgot your password?"
|
||||
end
|
||||
@ -24,28 +24,28 @@ defmodule MemexWeb.UserResetPasswordControllerTest do
|
||||
@tag :capture_log
|
||||
test "sends a new reset password token", %{conn: conn, user: user} do
|
||||
conn =
|
||||
post(conn, Routes.user_reset_password_path(conn, :create), %{
|
||||
post(conn, ~p"/users/reset_password", %{
|
||||
user: %{email: user.email}
|
||||
})
|
||||
|
||||
assert redirected_to(conn) == "/"
|
||||
|
||||
assert get_flash(conn, :info) =~
|
||||
"If your email is in our system, you will receive instructions to reset your password shortly."
|
||||
conn.assigns.flash["info"] =~
|
||||
"If your email is in our system, you will receive instructions to reset your password shortly."
|
||||
|
||||
assert Repo.get_by!(Accounts.UserToken, user_id: user.id).context == "reset_password"
|
||||
end
|
||||
|
||||
test "does not send reset password token if email is invalid", %{conn: conn} do
|
||||
conn =
|
||||
post(conn, Routes.user_reset_password_path(conn, :create), %{
|
||||
post(conn, ~p"/users/reset_password", %{
|
||||
user: %{email: "unknown@example.com"}
|
||||
})
|
||||
|
||||
assert redirected_to(conn) == "/"
|
||||
|
||||
assert get_flash(conn, :info) =~
|
||||
"If your email is in our system, you will receive instructions to reset your password shortly."
|
||||
conn.assigns.flash["info"] =~
|
||||
"If your email is in our system, you will receive instructions to reset your password shortly."
|
||||
|
||||
assert Repo.all(Accounts.UserToken) == []
|
||||
end
|
||||
@ -62,14 +62,14 @@ defmodule MemexWeb.UserResetPasswordControllerTest do
|
||||
end
|
||||
|
||||
test "renders reset password", %{conn: conn, token: token} do
|
||||
conn = get(conn, Routes.user_reset_password_path(conn, :edit, token))
|
||||
conn = get(conn, ~p"/users/reset_password/#{token}")
|
||||
assert html_response(conn, 200) =~ "Reset password"
|
||||
end
|
||||
|
||||
test "does not render reset password with invalid token", %{conn: conn} do
|
||||
conn = get(conn, Routes.user_reset_password_path(conn, :edit, "oops"))
|
||||
conn = get(conn, ~p"/users/reset_password/#{"oops"}")
|
||||
assert redirected_to(conn) == "/"
|
||||
assert get_flash(conn, :error) =~ "Reset password link is invalid or it has expired"
|
||||
conn.assigns.flash["error"] =~ "Reset password link is invalid or it has expired"
|
||||
end
|
||||
end
|
||||
|
||||
@ -85,22 +85,22 @@ defmodule MemexWeb.UserResetPasswordControllerTest do
|
||||
|
||||
test "resets password once", %{conn: conn, user: user, token: token} do
|
||||
conn =
|
||||
put(conn, Routes.user_reset_password_path(conn, :update, token), %{
|
||||
put(conn, ~p"/users/reset_password/#{token}", %{
|
||||
user: %{
|
||||
password: "new valid password",
|
||||
password_confirmation: "new valid password"
|
||||
}
|
||||
})
|
||||
|
||||
assert redirected_to(conn) == Routes.user_session_path(conn, :new)
|
||||
assert redirected_to(conn) == ~p"/users/log_in"
|
||||
refute get_session(conn, :user_token)
|
||||
assert get_flash(conn, :info) =~ "Password reset successfully"
|
||||
conn.assigns.flash["info"] =~ "Password reset successfully"
|
||||
assert Accounts.get_user_by_email_and_password(user.email, "new valid password")
|
||||
end
|
||||
|
||||
test "does not reset password on invalid data", %{conn: conn, token: token} do
|
||||
conn =
|
||||
put(conn, Routes.user_reset_password_path(conn, :update, token), %{
|
||||
put(conn, ~p"/users/reset_password/#{token}", %{
|
||||
user: %{
|
||||
password: "too short",
|
||||
password_confirmation: "does not match"
|
||||
@ -114,9 +114,9 @@ defmodule MemexWeb.UserResetPasswordControllerTest do
|
||||
end
|
||||
|
||||
test "does not reset password with invalid token", %{conn: conn} do
|
||||
conn = put(conn, Routes.user_reset_password_path(conn, :update, "oops"))
|
||||
conn = put(conn, ~p"/users/reset_password/#{"oops"}")
|
||||
assert redirected_to(conn) == "/"
|
||||
assert get_flash(conn, :error) =~ "Reset password link is invalid or it has expired"
|
||||
conn.assigns.flash["error"] =~ "Reset password link is invalid or it has expired"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -13,13 +13,13 @@ defmodule MemexWeb.UserSessionControllerTest do
|
||||
|
||||
describe "GET /users/log_in" do
|
||||
test "renders log in page", %{conn: conn} do
|
||||
conn = get(conn, Routes.user_session_path(conn, :new))
|
||||
conn = get(conn, ~p"/users/log_in")
|
||||
response = html_response(conn, 200)
|
||||
assert response =~ "log in"
|
||||
end
|
||||
|
||||
test "redirects if already logged in", %{conn: conn, current_user: current_user} do
|
||||
conn = conn |> log_in_user(current_user) |> get(Routes.user_session_path(conn, :new))
|
||||
conn = conn |> log_in_user(current_user) |> get(~p"/users/log_in")
|
||||
assert redirected_to(conn) == "/"
|
||||
end
|
||||
end
|
||||
@ -27,7 +27,7 @@ defmodule MemexWeb.UserSessionControllerTest do
|
||||
describe "POST /users/log_in" do
|
||||
test "logs the user in", %{conn: conn, current_user: current_user} do
|
||||
conn =
|
||||
post(conn, Routes.user_session_path(conn, :create), %{
|
||||
post(conn, ~p"/users/log_in", %{
|
||||
user: %{email: current_user.email, password: valid_user_password()}
|
||||
})
|
||||
|
||||
@ -43,7 +43,7 @@ defmodule MemexWeb.UserSessionControllerTest do
|
||||
|
||||
test "logs the user in with remember me", %{conn: conn, current_user: current_user} do
|
||||
conn =
|
||||
post(conn, Routes.user_session_path(conn, :create), %{
|
||||
post(conn, ~p"/users/log_in", %{
|
||||
user: %{
|
||||
email: current_user.email,
|
||||
password: valid_user_password(),
|
||||
@ -59,7 +59,7 @@ defmodule MemexWeb.UserSessionControllerTest do
|
||||
conn =
|
||||
conn
|
||||
|> init_test_session(user_return_to: "/foo/bar")
|
||||
|> post(Routes.user_session_path(conn, :create), %{
|
||||
|> post(~p"/users/log_in", %{
|
||||
user: %{
|
||||
email: current_user.email,
|
||||
password: valid_user_password()
|
||||
@ -72,7 +72,7 @@ defmodule MemexWeb.UserSessionControllerTest do
|
||||
test "emits error message with invalid credentials",
|
||||
%{conn: conn, current_user: current_user} do
|
||||
conn =
|
||||
post(conn, Routes.user_session_path(conn, :create), %{
|
||||
post(conn, ~p"/users/log_in", %{
|
||||
user: %{email: current_user.email, password: "bad"}
|
||||
})
|
||||
|
||||
@ -84,17 +84,17 @@ defmodule MemexWeb.UserSessionControllerTest do
|
||||
|
||||
describe "DELETE /users/log_out" do
|
||||
test "logs the user out", %{conn: conn, current_user: current_user} do
|
||||
conn = conn |> log_in_user(current_user) |> delete(Routes.user_session_path(conn, :delete))
|
||||
conn = conn |> log_in_user(current_user) |> delete(~p"/users/log_out")
|
||||
assert redirected_to(conn) == "/"
|
||||
refute get_session(conn, :user_token)
|
||||
assert get_flash(conn, :info) =~ "logged out successfully"
|
||||
conn.assigns.flash["info"] =~ "logged out successfully"
|
||||
end
|
||||
|
||||
test "succeeds even if the user is not logged in", %{conn: conn} do
|
||||
conn = delete(conn, Routes.user_session_path(conn, :delete))
|
||||
conn = delete(conn, ~p"/users/log_out")
|
||||
assert redirected_to(conn) == "/"
|
||||
refute get_session(conn, :user_token)
|
||||
assert get_flash(conn, :info) =~ "logged out successfully"
|
||||
conn.assigns.flash["info"] =~ "logged out successfully"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -12,15 +12,15 @@ defmodule MemexWeb.UserSettingsControllerTest do
|
||||
|
||||
describe "GET /users/settings" do
|
||||
test "renders settings page", %{conn: conn} do
|
||||
conn = get(conn, Routes.user_settings_path(conn, :edit))
|
||||
conn = get(conn, ~p"/users/settings")
|
||||
response = html_response(conn, 200)
|
||||
assert response =~ "settings"
|
||||
end
|
||||
|
||||
test "redirects if user is not logged in" do
|
||||
conn = build_conn()
|
||||
conn = get(conn, Routes.user_settings_path(conn, :edit))
|
||||
assert redirected_to(conn) == Routes.user_session_path(conn, :new)
|
||||
conn = get(conn, ~p"/users/settings")
|
||||
assert redirected_to(conn) == ~p"/users/log_in"
|
||||
end
|
||||
end
|
||||
|
||||
@ -28,7 +28,7 @@ defmodule MemexWeb.UserSettingsControllerTest do
|
||||
test "updates the user password and resets tokens",
|
||||
%{conn: conn, current_user: current_user} do
|
||||
new_password_conn =
|
||||
put(conn, Routes.user_settings_path(conn, :update), %{
|
||||
put(conn, ~p"/users/settings", %{
|
||||
action: "update_password",
|
||||
current_password: valid_user_password(),
|
||||
user: %{
|
||||
@ -37,16 +37,16 @@ defmodule MemexWeb.UserSettingsControllerTest do
|
||||
}
|
||||
})
|
||||
|
||||
assert redirected_to(new_password_conn) == Routes.user_settings_path(conn, :edit)
|
||||
assert redirected_to(new_password_conn) == ~p"/users/settings"
|
||||
assert get_session(new_password_conn, :user_token) != get_session(conn, :user_token)
|
||||
assert get_flash(new_password_conn, :info) =~ "password updated successfully"
|
||||
new_password_conn.assigns.flash["info"] =~ "password updated successfully"
|
||||
|
||||
assert Accounts.get_user_by_email_and_password(current_user.email, "new valid password")
|
||||
end
|
||||
|
||||
test "does not update password on invalid data", %{conn: conn} do
|
||||
old_password_conn =
|
||||
put(conn, Routes.user_settings_path(conn, :update), %{
|
||||
put(conn, ~p"/users/settings", %{
|
||||
action: "update_password",
|
||||
current_password: "invalid",
|
||||
user: %{
|
||||
@ -69,23 +69,23 @@ defmodule MemexWeb.UserSettingsControllerTest do
|
||||
@tag :capture_log
|
||||
test "updates the user email", %{conn: conn, current_user: current_user} do
|
||||
conn =
|
||||
put(conn, Routes.user_settings_path(conn, :update), %{
|
||||
put(conn, ~p"/users/settings", %{
|
||||
action: "update_email",
|
||||
current_password: valid_user_password(),
|
||||
user: %{"email" => unique_user_email()}
|
||||
})
|
||||
|
||||
assert redirected_to(conn) == Routes.user_settings_path(conn, :edit)
|
||||
assert redirected_to(conn) == ~p"/users/settings"
|
||||
|
||||
assert get_flash(conn, :info) =~
|
||||
"a link to confirm your email change has been sent to the new address."
|
||||
conn.assigns.flash["info"] =~
|
||||
"a link to confirm your email change has been sent to the new address."
|
||||
|
||||
assert Accounts.get_user_by_email(current_user.email)
|
||||
end
|
||||
|
||||
test "does not update email on invalid data", %{conn: conn} do
|
||||
conn =
|
||||
put(conn, Routes.user_settings_path(conn, :update), %{
|
||||
put(conn, ~p"/users/settings", %{
|
||||
"action" => "update_email",
|
||||
"current_password" => "invalid",
|
||||
"user" => %{"email" => "with spaces"}
|
||||
@ -116,28 +116,28 @@ defmodule MemexWeb.UserSettingsControllerTest do
|
||||
|
||||
test "updates the user email once",
|
||||
%{conn: conn, current_user: current_user, token: token, email: email} do
|
||||
conn = get(conn, Routes.user_settings_path(conn, :confirm_email, token))
|
||||
assert redirected_to(conn) == Routes.user_settings_path(conn, :edit)
|
||||
assert get_flash(conn, :info) =~ "email changed successfully"
|
||||
conn = get(conn, ~p"/users/settings/confirm_email/#{token}")
|
||||
assert redirected_to(conn) == ~p"/users/settings"
|
||||
conn.assigns.flash["info"] =~ "email changed successfully"
|
||||
refute Accounts.get_user_by_email(current_user.email)
|
||||
assert Accounts.get_user_by_email(email)
|
||||
|
||||
conn = get(conn, Routes.user_settings_path(conn, :confirm_email, token))
|
||||
assert redirected_to(conn) == Routes.user_settings_path(conn, :edit)
|
||||
assert get_flash(conn, :error) =~ "email change link is invalid or it has expired"
|
||||
conn = get(conn, ~p"/users/settings/confirm_email/#{token}")
|
||||
assert redirected_to(conn) == ~p"/users/settings"
|
||||
conn.assigns.flash["error"] =~ "email change link is invalid or it has expired"
|
||||
end
|
||||
|
||||
test "does not update email with invalid token", %{conn: conn, current_user: current_user} do
|
||||
conn = get(conn, Routes.user_settings_path(conn, :confirm_email, "oops"))
|
||||
assert redirected_to(conn) == Routes.user_settings_path(conn, :edit)
|
||||
assert get_flash(conn, :error) =~ "email change link is invalid or it has expired"
|
||||
conn = get(conn, ~p"/users/settings/confirm_email/#{"oops"}")
|
||||
assert redirected_to(conn) == ~p"/users/settings"
|
||||
conn.assigns.flash["error"] =~ "email change link is invalid or it has expired"
|
||||
assert Accounts.get_user_by_email(current_user.email)
|
||||
end
|
||||
|
||||
test "redirects if user is not logged in", %{token: token} do
|
||||
conn = build_conn()
|
||||
conn = get(conn, Routes.user_settings_path(conn, :confirm_email, token))
|
||||
assert redirected_to(conn) == Routes.user_session_path(conn, :new)
|
||||
conn = get(conn, ~p"/users/settings/confirm_email/#{token}")
|
||||
assert redirected_to(conn) == ~p"/users/log_in"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user