Add authorised routes with tests
This commit is contained in:
parent
37985ac1cf
commit
8590df5032
6 changed files with 131 additions and 1 deletions
test/support/fixtures
|
@ -19,6 +19,18 @@ defmodule RealEstate.AccountsFixtures do
|
|||
user
|
||||
end
|
||||
|
||||
def admin_fixture(attrs \\ %{}) do
|
||||
{:ok, user} =
|
||||
attrs
|
||||
|> Enum.into(%{
|
||||
email: unique_user_email(),
|
||||
password: valid_user_password()
|
||||
})
|
||||
|> RealEstate.Accounts.register_admin()
|
||||
|
||||
user
|
||||
end
|
||||
|
||||
def extract_user_token(fun) do
|
||||
{:ok, captured} = fun.(&"[TOKEN]#{&1}[TOKEN]")
|
||||
[_, token, _] = String.split(captured.body, "[TOKEN]")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue