analytics/test/plausible_web/controllers/admin_auth_controller_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

29 lines
834 B
Elixir

defmodule PlausibleWeb.AdminAuthControllerTest do
use PlausibleWeb.ConnCase
alias Plausible.Release
describe "GET /" do
@describetag :ce_build_only
test "disable registration", %{conn: conn} do
insert(:user)
patch_config(disable_registration: true)
conn = get(conn, "/register")
assert redirected_to(conn) == "/login"
end
test "disable registration + first launch", %{conn: conn} do
patch_config(disable_registration: true)
assert Release.should_be_first_launch?()
# "first launch" takes precedence
conn = get(conn, "/register")
assert html_response(conn, 200) =~ "Enter your details"
end
end
def patch_config(config) do
updated_config = Keyword.merge([disable_registration: false], config)
patch_env(:selfhost, updated_config)
end
end