mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 05:23:18 +12:00
chore: update ash, add tests for field policies
This commit is contained in:
parent
be15759de0
commit
3146d5f97d
3 changed files with 5 additions and 27 deletions
2
mix.exs
2
mix.exs
|
@ -158,7 +158,7 @@ defmodule AshPostgres.MixProject do
|
|||
{:jason, "~> 1.0"},
|
||||
{:postgrex, ">= 0.0.0"},
|
||||
{:ash,
|
||||
ash_version(github: "ash-project/ash", ref: "80fc8b0896f6ef59a26c220009cd20d6042ad7d2")},
|
||||
ash_version(github: "ash-project/ash", ref: "e9d2d8c575f700ced88ed563fc015af8061f0df0")},
|
||||
{: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},
|
||||
|
|
|
@ -5,31 +5,6 @@ defmodule FilterFieldPolicyTest do
|
|||
|
||||
require Ash.Query
|
||||
|
||||
setup do
|
||||
# I needed this to make the query actually fail
|
||||
# this triggers an exeption in the reporting of
|
||||
# the policy breakdowns because the policies are
|
||||
# nil
|
||||
|
||||
# Without this it would just run the query which
|
||||
# might be even worse as the policies are not applied
|
||||
# correctly and I guess `nil` is a special case for
|
||||
# field policies because you can have no polcies
|
||||
# and that is still valid?
|
||||
current_level = Logger.level()
|
||||
current_setting = Application.get_env(:ash, :policies)
|
||||
|
||||
Application.put_env(
|
||||
:ash,
|
||||
:policies,
|
||||
Keyword.merge(current_setting |> List.wrap(), log_policy_breakdowns: current_level)
|
||||
)
|
||||
|
||||
on_exit(fn ->
|
||||
Application.put_env(:ash, :policies, current_setting)
|
||||
end)
|
||||
end
|
||||
|
||||
test "filter uses the correct field policies when exanding refs" do
|
||||
organization =
|
||||
Organization
|
||||
|
|
|
@ -18,7 +18,10 @@ defmodule AshPostgres.Test.User do
|
|||
end
|
||||
|
||||
relationships do
|
||||
belongs_to(:organization, AshPostgres.Test.Organization)
|
||||
belongs_to :organization, AshPostgres.Test.Organization do
|
||||
attribute_writable?(true)
|
||||
end
|
||||
|
||||
has_many(:accounts, AshPostgres.Test.Account)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue