mirror of
https://github.com/fly-apps/live_beats.git
synced 2024-12-24 16:00:29 +00:00
33 lines
805 B
Elixir
33 lines
805 B
Elixir
defmodule LiveBeats.MediaLibraryFixtures do
|
|
@moduledoc """
|
|
This module defines test helpers for creating
|
|
entities via the `LiveBeats.MediaLibrary` context.
|
|
"""
|
|
|
|
alias LiveBeats.MediaLibrary.Song
|
|
|
|
@doc """
|
|
Generate a song.
|
|
"""
|
|
def song_fixture(attrs \\ %{}) do
|
|
{:ok, song} =
|
|
struct!(
|
|
Song,
|
|
Enum.into(attrs, %{
|
|
album_artist: "some album_artist",
|
|
artist: "some artist",
|
|
date_recorded: ~N[2021-10-26 20:11:00],
|
|
date_released: ~N[2021-10-26 20:11:00],
|
|
duration: 42,
|
|
title: "some title",
|
|
mp3_url: "//example.com/mp3.mp3",
|
|
mp3_filename: "mp3.mp3",
|
|
mp3_filepath: "/data/mp3.mp3",
|
|
status: :stopped
|
|
})
|
|
)
|
|
|> LiveBeats.Repo.insert()
|
|
|
|
song
|
|
end
|
|
end
|