Add tests for system actor protection and hiding

Index: system actor not in list, destroy returns Ash.Error.Invalid. Show/Form:
redirect to /users when viewing or editing system actor user.
This commit is contained in:
Moritz 2026-01-27 14:29:26 +01:00 committed by moritz
parent 8ad5201e1a
commit 9c31f0c16c
4 changed files with 57 additions and 8 deletions

View file

@ -154,4 +154,14 @@ defmodule MvWeb.UserLive.ShowTest do
assert html =~ gettext("Show User") || html =~ to_string(user.email)
end
end
describe "system actor user" do
test "redirects to user list when viewing system actor user", %{conn: conn} do
system_actor = Mv.Helpers.SystemActor.get_system_actor()
conn = conn_with_oidc_user(conn)
assert {:error, {:live_redirect, %{to: "/users"}}} =
live(conn, ~p"/users/#{system_actor.id}")
end
end
end