I'm writing tests and have a helper to log_in_user that I found in ash-hq source.
def log_in_user(conn, user) do conn |> Phoenix.ConnTest.init_test_session(%{}) |> Plug.Conn.put_session(:user_token, user.__metadata__.token) end
def log_in_user(conn, user) do conn |> Phoenix.ConnTest.init_test_session(%{}) |> Plug.Conn.put_session(:user_token, user.__metadata__.token) end
But
user.__metadata__ == %{}
user.__metadata__ == %{}
which makes sense since I'm generating the user with Ash.Seed. In ash-hq the user is created by a register action which I assume sets the metadata, but don't see how. I don't have an equivalent register action.
The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.