fix account urls
This commit is contained in:
parent
8e1bb5c333
commit
e218290e08
19 changed files with 102 additions and 102 deletions
|
@ -10,17 +10,17 @@ defmodule WildWeb.UserSettingsLiveTest do
|
|||
{:ok, _lv, html} =
|
||||
conn
|
||||
|> log_in_user(user_fixture())
|
||||
|> live(~p"/users/settings")
|
||||
|> live(~p"/account/settings")
|
||||
|
||||
assert html =~ "Change Email"
|
||||
assert html =~ "Change Password"
|
||||
end
|
||||
|
||||
test "redirects if user is not logged in", %{conn: conn} do
|
||||
assert {:error, redirect} = live(conn, ~p"/users/settings")
|
||||
assert {:error, redirect} = live(conn, ~p"/account/settings")
|
||||
|
||||
assert {:redirect, %{to: path, flash: flash}} = redirect
|
||||
assert path == ~p"/users/log_in"
|
||||
assert path == ~p"/account/log_in"
|
||||
assert %{"error" => "You must log in to access this page."} = flash
|
||||
end
|
||||
end
|
||||
|
@ -35,7 +35,7 @@ defmodule WildWeb.UserSettingsLiveTest do
|
|||
test "updates the user email", %{conn: conn, password: password, user: user} do
|
||||
new_email = unique_user_email()
|
||||
|
||||
{:ok, lv, _html} = live(conn, ~p"/users/settings")
|
||||
{:ok, lv, _html} = live(conn, ~p"/account/settings")
|
||||
|
||||
result =
|
||||
lv
|
||||
|
@ -50,7 +50,7 @@ defmodule WildWeb.UserSettingsLiveTest do
|
|||
end
|
||||
|
||||
test "renders errors with invalid data (phx-change)", %{conn: conn} do
|
||||
{:ok, lv, _html} = live(conn, ~p"/users/settings")
|
||||
{:ok, lv, _html} = live(conn, ~p"/account/settings")
|
||||
|
||||
result =
|
||||
lv
|
||||
|
@ -66,7 +66,7 @@ defmodule WildWeb.UserSettingsLiveTest do
|
|||
end
|
||||
|
||||
test "renders errors with invalid data (phx-submit)", %{conn: conn, user: user} do
|
||||
{:ok, lv, _html} = live(conn, ~p"/users/settings")
|
||||
{:ok, lv, _html} = live(conn, ~p"/account/settings")
|
||||
|
||||
result =
|
||||
lv
|
||||
|
@ -92,7 +92,7 @@ defmodule WildWeb.UserSettingsLiveTest do
|
|||
test "updates the user password", %{conn: conn, user: user, password: password} do
|
||||
new_password = valid_user_password()
|
||||
|
||||
{:ok, lv, _html} = live(conn, ~p"/users/settings")
|
||||
{:ok, lv, _html} = live(conn, ~p"/account/settings")
|
||||
|
||||
form =
|
||||
form(lv, "#password_form", %{
|
||||
|
@ -108,7 +108,7 @@ defmodule WildWeb.UserSettingsLiveTest do
|
|||
|
||||
new_password_conn = follow_trigger_action(form, conn)
|
||||
|
||||
assert redirected_to(new_password_conn) == ~p"/users/settings"
|
||||
assert redirected_to(new_password_conn) == ~p"/account/settings"
|
||||
|
||||
assert get_session(new_password_conn, :user_token) != get_session(conn, :user_token)
|
||||
|
||||
|
@ -119,7 +119,7 @@ defmodule WildWeb.UserSettingsLiveTest do
|
|||
end
|
||||
|
||||
test "renders errors with invalid data (phx-change)", %{conn: conn} do
|
||||
{:ok, lv, _html} = live(conn, ~p"/users/settings")
|
||||
{:ok, lv, _html} = live(conn, ~p"/account/settings")
|
||||
|
||||
result =
|
||||
lv
|
||||
|
@ -138,7 +138,7 @@ defmodule WildWeb.UserSettingsLiveTest do
|
|||
end
|
||||
|
||||
test "renders errors with invalid data (phx-submit)", %{conn: conn} do
|
||||
{:ok, lv, _html} = live(conn, ~p"/users/settings")
|
||||
{:ok, lv, _html} = live(conn, ~p"/account/settings")
|
||||
|
||||
result =
|
||||
lv
|
||||
|
@ -172,27 +172,27 @@ defmodule WildWeb.UserSettingsLiveTest do
|
|||
end
|
||||
|
||||
test "updates the user email once", %{conn: conn, user: user, token: token, email: email} do
|
||||
{:error, redirect} = live(conn, ~p"/users/settings/confirm_email/#{token}")
|
||||
{:error, redirect} = live(conn, ~p"/account/settings/confirm_email/#{token}")
|
||||
|
||||
assert {:live_redirect, %{to: path, flash: flash}} = redirect
|
||||
assert path == ~p"/users/settings"
|
||||
assert path == ~p"/account/settings"
|
||||
assert %{"info" => message} = flash
|
||||
assert message == "Email changed successfully."
|
||||
refute Accounts.get_user_by_email(user.email)
|
||||
assert Accounts.get_user_by_email(email)
|
||||
|
||||
# use confirm token again
|
||||
{:error, redirect} = live(conn, ~p"/users/settings/confirm_email/#{token}")
|
||||
{:error, redirect} = live(conn, ~p"/account/settings/confirm_email/#{token}")
|
||||
assert {:live_redirect, %{to: path, flash: flash}} = redirect
|
||||
assert path == ~p"/users/settings"
|
||||
assert path == ~p"/account/settings"
|
||||
assert %{"error" => message} = flash
|
||||
assert message == "Email change link is invalid or it has expired."
|
||||
end
|
||||
|
||||
test "does not update email with invalid token", %{conn: conn, user: user} do
|
||||
{:error, redirect} = live(conn, ~p"/users/settings/confirm_email/oops")
|
||||
{:error, redirect} = live(conn, ~p"/account/settings/confirm_email/oops")
|
||||
assert {:live_redirect, %{to: path, flash: flash}} = redirect
|
||||
assert path == ~p"/users/settings"
|
||||
assert path == ~p"/account/settings"
|
||||
assert %{"error" => message} = flash
|
||||
assert message == "Email change link is invalid or it has expired."
|
||||
assert Accounts.get_user_by_email(user.email)
|
||||
|
@ -200,9 +200,9 @@ defmodule WildWeb.UserSettingsLiveTest do
|
|||
|
||||
test "redirects if user is not logged in", %{token: token} do
|
||||
conn = build_conn()
|
||||
{:error, redirect} = live(conn, ~p"/users/settings/confirm_email/#{token}")
|
||||
{:error, redirect} = live(conn, ~p"/account/settings/confirm_email/#{token}")
|
||||
assert {:redirect, %{to: path, flash: flash}} = redirect
|
||||
assert path == ~p"/users/log_in"
|
||||
assert path == ~p"/account/log_in"
|
||||
assert %{"error" => message} = flash
|
||||
assert message == "You must log in to access this page."
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue