Encountering some problems using ash seed to create a user in tests

Hello,

I’m trying to seed a user for some tests, but I feel I’m missing something.

I’d expect to be able to query the user after seeding but that doesn’t seem to be working. Running the following test fails on the second assert.

Is this intended behaviour? or am I doing something wrong?

( everything is pretty much the default generated code w/ ash auth)

defmodule MyApp.Accounts.UserSeedTest do
  use MyApp.DataCase
  alias MyApp.Accounts.User

  describe "user seeding" do
    test "can seed and query a user" do
      # Create a test user via seeding
      user = Ash.Seed.seed!(%User{
        email: "test.seed@example.com",
        hashed_password: Bcrypt.hash_pwd_salt("Password123!"),
        confirmed_at: DateTime.utc_now()
      })

      query_user =
        User
        |> Ash.Query.for_read(:get_by_email, %{email: "test.seed@example.com"})
        |> Ash.read_one!()

      assert user != nil
      assert query_user != nil
      assert query_user.id == user.id
    end
  end
end

How does it fail?

You aren’t providing an actor to your read action so if you have any policies this will fail.

How does it fail?

query_user will be nil

You aren’t providing an actor to your read action so if you have any policies this will fail.

that’s the problem thanks!