defmodule Zoeyscomputer.ApiKeysFixtures do
  @moduledoc """
  This module defines test helpers for creating
  entities via the `Zoeyscomputer.ApiKeys` context.
  """

  @doc """
  Generate a unique api_key token.
  """
  def unique_api_key_token, do: "some token#{System.unique_integer([:positive])}"

  @doc """
  Generate a api_key.
  """
  def api_key_fixture(attrs \\ %{}) do
    {:ok, api_key} =
      attrs
      |> Enum.into(%{
        name: "some name",
        token: unique_api_key_token()
      })
      |> Zoeyscomputer.ApiKeys.create_api_key()

    api_key
  end
end
