test: add test for filter policy on bulk actions

This commit is contained in:
Zach Daniel 2024-02-14 17:54:28 -05:00
parent 7a4fe87561
commit 256b4d0b9a
3 changed files with 10 additions and 3 deletions

View file

@ -158,7 +158,7 @@ defmodule AshPostgres.MixProject do
{:jason, "~> 1.0"},
{:postgrex, ">= 0.0.0"},
{:ash,
ash_version(github: "ash-project/ash", ref: "f23f0a29fec8a231e3fbff64034be8c9efb87e73")},
ash_version(github: "ash-project/ash", ref: "dcbccec7c36e2cad9d8366fa797b617e043b7b28")},
{:benchee, "~> 1.1", only: [:dev, :test]},
{:git_ops, "~> 2.5", only: [:dev, :test]},
{:ex_doc, github: "elixir-lang/ex_doc", only: [:dev, :test], runtime: false},

View file

@ -18,8 +18,15 @@ defmodule AshPostgresTest do
|> Ash.Changeset.new(%{title: "good"})
|> AshPostgres.Test.Api.create!()
assert_raise Ash.Error.Forbidden, fn ->
post
|> Ash.Changeset.for_update(:update, %{title: "bad"}, authorize?: true)
|> AshPostgres.Test.Api.update!()
|> Map.get(:title)
end
post
|> Ash.Changeset.for_update(:update, %{title: "bad"}, authorize?: true)
|> Ash.Changeset.for_update(:update, %{title: "okay"}, authorize?: true)
|> AshPostgres.Test.Api.update!()
|> Map.get(:title)
end

View file

@ -1,7 +1,7 @@
defmodule FilterFieldPolicyTest do
use AshPostgres.RepoCase, async: false
alias AshPostgres.Test.{Api, Post, Organization, User}
alias AshPostgres.Test.{Api, Organization, Post, User}
require Ash.Query