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:
parent
8ad5201e1a
commit
9c31f0c16c
4 changed files with 57 additions and 8 deletions
|
|
@ -405,6 +405,27 @@ defmodule MvWeb.UserLive.IndexTest do
|
|||
end
|
||||
end
|
||||
|
||||
describe "system actor user" do
|
||||
test "does not show system actor user in list", %{conn: conn} do
|
||||
# Ensure system actor exists (e.g. via get_system_actor in conn_with_oidc_user)
|
||||
_system_actor = Mv.Helpers.SystemActor.get_system_actor()
|
||||
system_email = Mv.Helpers.SystemActor.system_user_email()
|
||||
|
||||
conn = conn_with_oidc_user(conn)
|
||||
{:ok, _view, html} = live(conn, "/users")
|
||||
|
||||
refute html =~ system_email,
|
||||
"System actor user (#{system_email}) must not appear in the user list"
|
||||
end
|
||||
|
||||
test "destroying system actor user returns error", %{current_user: current_user} do
|
||||
system_actor = Mv.Helpers.SystemActor.get_system_actor()
|
||||
|
||||
assert {:error, %Ash.Error.Invalid{}} =
|
||||
Ash.destroy(system_actor, domain: Mv.Accounts, actor: current_user)
|
||||
end
|
||||
end
|
||||
|
||||
describe "member linking display" do
|
||||
test "displays linked member name in user list", %{conn: conn} do
|
||||
system_actor = Mv.Helpers.SystemActor.get_system_actor()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue