analytics/test/plausible_web/controllers/auth_controller_sync_test.exs
hq1 d6824de1ad
Rename internal build symbols (#3942)
* Rename internal build symbols

* Rename remaining + add `on_ce` macro

cc @ruslandoga
2024-04-29 08:05:33 +02:00

44 lines
1.1 KiB
Elixir

defmodule PlausibleWeb.AuthControllerSyncTest do
use PlausibleWeb.ConnCase
use Bamboo.Test
use Plausible.Repo
alias Plausible.Auth.User
describe "PUT /settings/email" do
setup [:create_user, :log_in]
@tag :ce_build_only
test "updates email but DOES NOT force reverification when feature disabled", %{
conn: conn,
user: user
} do
patch_env(:selfhost, enable_email_verification: false)
password = "very-long-very-secret-123"
user
|> User.set_password(password)
|> Repo.update!()
assert user.email_verified
conn =
put(conn, "/settings/email", %{
"user" => %{"email" => "new" <> user.email, "password" => password}
})
assert redirected_to(conn, 302) ==
Routes.auth_path(conn, :user_settings) <> "#change-email-address"
updated_user = Repo.reload!(user)
assert updated_user.email == "new" <> user.email
assert updated_user.previous_email == user.email
assert updated_user.email_verified
assert_no_emails_delivered()
end
end
end