fix: make sure smtp can be set either via env or ui
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:
parent
a244b1b07e
commit
605a897045
9 changed files with 201 additions and 42 deletions
|
|
@ -172,6 +172,34 @@ defmodule MvWeb.GlobalSettingsLiveTest do
|
|||
{:ok, _view, html} = live(conn, ~p"/settings")
|
||||
assert html =~ "SMTP is fully managed via environment variables"
|
||||
end
|
||||
|
||||
@tag :ui
|
||||
test "shows warning block for missing required SMTP ENV values in ENV-only mode", %{
|
||||
conn: conn
|
||||
} do
|
||||
clear_smtp_env()
|
||||
System.put_env("SMTP_HOST", "smtp.env-only.example")
|
||||
on_exit(fn -> clear_smtp_env() end)
|
||||
|
||||
{:ok, _view, html} = live(conn, ~p"/settings")
|
||||
assert html =~ "SMTP environment configuration appears incomplete"
|
||||
assert html =~ "SMTP_USERNAME"
|
||||
assert html =~ "SMTP_PASSWORD/SMTP_PASSWORD_FILE"
|
||||
end
|
||||
|
||||
@tag :ui
|
||||
test "does not enter ENV-only mode when SMTP_HOST is not set", %{conn: conn} do
|
||||
clear_smtp_env()
|
||||
System.put_env("SMTP_USERNAME", "leftover@example.com")
|
||||
on_exit(fn -> clear_smtp_env() end)
|
||||
|
||||
{:ok, view, html} = live(conn, ~p"/settings")
|
||||
|
||||
refute html =~ "SMTP is fully managed via environment variables"
|
||||
refute html =~ "SMTP environment configuration appears incomplete"
|
||||
refute has_element?(view, "#setting_smtp_host[disabled]")
|
||||
refute has_element?(view, "#setting_smtp_username[disabled]")
|
||||
end
|
||||
end
|
||||
|
||||
describe "Authentication section when OIDC-only is enabled" do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue