fix: make sure smtp can be set either via env or ui
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simon 2026-05-07 10:01:19 +02:00
parent a244b1b07e
commit 605a897045
Signed by: simon
GPG key ID: 40E7A58C4AA1EDB2
9 changed files with 201 additions and 42 deletions

View file

@ -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