Merge remote-tracking branch 'origin/main' into feature/372-groups-management
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:
commit
3eb4cde0b7
17 changed files with 330 additions and 38 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -420,4 +420,14 @@ defmodule MvWeb.UserLive.FormTest do
|
|||
assert is_nil(updated_user.member)
|
||||
end
|
||||
end
|
||||
|
||||
describe "system actor user" do
|
||||
test "redirects to user list when editing system actor user", %{conn: conn} do
|
||||
system_actor = Mv.Helpers.SystemActor.get_system_actor()
|
||||
conn = conn_with_oidc_user(conn, %{email: "admin@example.com"})
|
||||
|
||||
assert {:error, {:live_redirect, %{to: "/users"}}} =
|
||||
live(conn, "/users/#{system_actor.id}/edit")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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