Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defmodule Database.DataFixtures do
- def admin_user do
- alias Database.AdminUsers
- quote do
- @valid_attrs %{
- username: "test_name",
- password: "test_pwd",
- accreditation: "user",
- email: "test@mail.test"
- }
- @update_attrs %{
- username: "test_name_updated",
- password: "test_pwd",
- accreditation: "user",
- email: "test@mail.test"
- }
- @invalid_attrs %{
- username: nil,
- password: nil,
- accreditation: nil,
- email: "test@mail.test"
- }
- def admin_user_fixture(attrs \\ %{}) do
- {:ok, admin_user} =
- attrs
- |> Enum.into(@valid_attrs)
- |> AdminUsers.create_admin_user()
- admin_user
- end
- end
- end
- defmacro __using__(fixtures) when is_list(fixtures) do
- for fixture <- fixtures, is_atom(fixture),
- do: apply(__MODULE__, fixture, [])
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement