mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
test: Remove unnecessary 'authorize?: false' and explicitly specify the filter policy results. (#798)
This commit is contained in:
parent
f963c8b971
commit
30deb8c32e
1 changed files with 17 additions and 7 deletions
|
@ -43,9 +43,7 @@ defmodule Ash.Test.Policy.ComplexTest do
|
||||||
Comment.create!(
|
Comment.create!(
|
||||||
post_by_my_friend.id,
|
post_by_my_friend.id,
|
||||||
"comment by a friend of a friend on my post",
|
"comment by a friend of a friend on my post",
|
||||||
actor: a_friend_of_my_friend,
|
actor: a_friend_of_my_friend
|
||||||
# bypass auth to make a comment in this state
|
|
||||||
authorize?: false
|
|
||||||
)
|
)
|
||||||
|
|
||||||
[
|
[
|
||||||
|
@ -62,16 +60,28 @@ defmodule Ash.Test.Policy.ComplexTest do
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it properly limits on reads", %{me: me} do
|
test "it properly limits on reads", %{
|
||||||
assert [_, _] =
|
me: me,
|
||||||
|
post_by_me: post_by_me,
|
||||||
|
post_by_my_friend: post_by_my_friend
|
||||||
|
} do
|
||||||
|
assert [post_by_me.id, post_by_my_friend.id] |> Enum.sort() ==
|
||||||
Post
|
Post
|
||||||
|> Api.read!(actor: me)
|
|> Api.read!(actor: me)
|
||||||
|
|> Enum.map(& &1.id)
|
||||||
|
|> Enum.sort()
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it properly limits on reads of comments", %{me: me} do
|
test "it properly limits on reads of comments", %{
|
||||||
assert [_, _] =
|
me: me,
|
||||||
|
comment_by_me_on_my_post: comment_by_me_on_my_post,
|
||||||
|
comment_by_my_friend_on_my_post: comment_by_my_friend_on_my_post
|
||||||
|
} do
|
||||||
|
assert [comment_by_me_on_my_post.id, comment_by_my_friend_on_my_post.id] |> Enum.sort() ==
|
||||||
Comment
|
Comment
|
||||||
|> Api.read!(actor: me)
|
|> Api.read!(actor: me)
|
||||||
|
|> Enum.map(& &1.id)
|
||||||
|
|> Enum.sort()
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it properly scopes filters", %{me: me} do
|
test "it properly scopes filters", %{me: me} do
|
||||||
|
|
Loading…
Reference in a new issue