1.3 KiB · text History 5dd4046
defmodule CartosnapApp.PhotosFixtures do
  @moduledoc """
  This module defines test helpers for creating
  entities via the `CartosnapApp.Photos` context.
  """

  @doc """
  Generate a trip.
  """
  def trip_fixture(attrs \\ %{}) do
    {:ok, trip} =
      attrs
      |> Enum.into(%{
        date_end: ~D[2022-03-28],
        date_start: ~D[2022-03-28],
        geo: "some geo",
        meta: %{},
        name: "some name"
      })
      |> CartosnapApp.Photos.create_trip()

    trip
  end

  @doc """
  Generate a photo.
  """
  def photo_fixture(attrs \\ %{}) do
    {:ok, photo} =
      attrs
      |> Enum.into(%{
        blurhash: "some blurhash",
        date: ~D[2022-04-06],
        exif: %{},
        filename: "some filename",
        geo_point: "some geo_point",
        name: "some name",
        promoted: true,
        url_full: "some url_full",
        url_original: "some url_original",
        url_preview: "some url_preview",
        url_thumb: "some url_thumb"
      })
      |> CartosnapApp.Photos.create_photo()

    photo
  end

  @doc """
  Generate a photo_trip.
  """
  def photo_trip_fixture(attrs \\ %{}) do
    {:ok, photo_trip} =
      attrs
      |> Enum.into(%{

      })
      |> CartosnapApp.Photos.create_photo_trip()

    photo_trip
  end
end