test: Reproduce flow custom step has no tenant in context (#901)

This commit is contained in:
Jechol Lee 2024-02-17 07:47:54 +09:00 committed by GitHub
parent 5253c3c3f2
commit b4ade107cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -51,6 +51,21 @@ defmodule Ash.Flow.TenantTest do
end
end
defmodule GetPost do
use Ash.Flow.Step
def run(%{id: post_id}, _opts, context) do
opts = context |> Ash.context_to_opts() |> IO.inspect()
posts =
Post
|> Ash.Query.for_read(:get_by_id, %{id: post_id})
|> Api.read!(opts)
{:ok, posts |> List.first()}
end
end
defmodule DestroyPost do
use Ash.Flow
@ -65,8 +80,7 @@ defmodule Ash.Flow.TenantTest do
end
steps do
read :get_post, Post, :get_by_id do
get? true
custom :get_post, GetPost do
input %{id: arg(:post_id)}
end