fix admin user fixture

This commit is contained in:
shibao 2022-11-23 21:14:29 -05:00
parent e0ac714681
commit 2ec60ba342

View File

@ -13,6 +13,7 @@ defmodule Cannery.Fixtures do
Containers, Containers,
Containers.Container, Containers.Container,
Email, Email,
Repo,
Tags, Tags,
Tags.Tag Tags.Tag
} }
@ -38,11 +39,12 @@ defmodule Cannery.Fixtures do
attrs attrs
|> Enum.into(%{ |> Enum.into(%{
"email" => unique_user_email(), "email" => unique_user_email(),
"password" => valid_user_password(), "password" => valid_user_password()
"role" => "admin"
}) })
|> Accounts.register_user() |> Accounts.register_user()
|> unwrap_ok_tuple() |> unwrap_ok_tuple()
|> User.role_changeset("admin")
|> Repo.update!()
end end
def extract_user_token(fun) do def extract_user_token(fun) do