Add actor parameter to all tests requiring authorization
This commit adds actor: system_actor to all Ash operations in tests that require authorization.
This commit is contained in:
parent
686f69c9e9
commit
0f48a9b15a
75 changed files with 4686 additions and 2859 deletions
|
|
@ -115,15 +115,16 @@ defmodule MvWeb.ConnCase do
|
|||
|
||||
# Create admin role and assign it
|
||||
admin_role = Mv.Fixtures.role_fixture("admin")
|
||||
system_actor = Mv.Helpers.SystemActor.get_system_actor()
|
||||
|
||||
{:ok, user} =
|
||||
user
|
||||
|> Ash.Changeset.for_update(:update, %{})
|
||||
|> Ash.Changeset.manage_relationship(:role, admin_role, type: :append_and_remove)
|
||||
|> Ash.update()
|
||||
|> Ash.update(actor: system_actor)
|
||||
|
||||
# Load role for authorization
|
||||
user_with_role = Ash.load!(user, :role, domain: Mv.Accounts)
|
||||
user_with_role = Ash.load!(user, :role, domain: Mv.Accounts, actor: system_actor)
|
||||
|
||||
sign_in_user_via_oidc(conn, user_with_role)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue