Namespace Last.Fm fixtures
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
defmodule LastFm.ArtistTest do
|
defmodule LastFm.ArtistTest do
|
||||||
use ExUnit.Case, async: true
|
use ExUnit.Case, async: true
|
||||||
|
|
||||||
@api_response_path Path.expand("../support/fixtures/artist.getinfo.json", __DIR__)
|
@api_response_path Path.expand("../support/fixtures/last_fm/artist.getinfo.json", __DIR__)
|
||||||
|
|
||||||
describe "from_api_response/1" do
|
describe "from_api_response/1" do
|
||||||
test "returns correct data" do
|
test "returns correct data" do
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
defmodule LastFm.TrackTest do
|
defmodule LastFm.TrackTest do
|
||||||
use ExUnit.Case, async: true
|
use ExUnit.Case, async: true
|
||||||
|
|
||||||
@api_response_path Path.expand("../support/fixtures/user.getrecenttracks.json", __DIR__)
|
@api_response_path Path.expand("../support/fixtures/last_fm/user.getrecenttracks.json", __DIR__)
|
||||||
|
|
||||||
describe "from_api_response/1" do
|
describe "from_api_response/1" do
|
||||||
test "returns correct data" do
|
test "returns correct data" do
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ defmodule MusicLibrary.ArtistsTest do
|
|||||||
alias MusicLibrary.Artists
|
alias MusicLibrary.Artists
|
||||||
alias LastFm.APIBehaviourMock
|
alias LastFm.APIBehaviourMock
|
||||||
import MusicLibrary.RecordsFixtures
|
import MusicLibrary.RecordsFixtures
|
||||||
import LastFm.Fixtures
|
import LastFm.Fixtures.Artist
|
||||||
import Mox
|
import Mox
|
||||||
|
|
||||||
setup :verify_on_exit!
|
setup :verify_on_exit!
|
||||||
@@ -46,7 +46,7 @@ defmodule MusicLibrary.ArtistsTest do
|
|||||||
[artist] = collection_record.artists
|
[artist] = collection_record.artists
|
||||||
artist_musicbrainz_id = artist.musicbrainz_id
|
artist_musicbrainz_id = artist.musicbrainz_id
|
||||||
|
|
||||||
expected_info = artist_get_info()
|
expected_info = get_info()
|
||||||
|
|
||||||
expect(APIBehaviourMock, :get_artist_info, fn {:musicbrainz_id, ^artist_musicbrainz_id},
|
expect(APIBehaviourMock, :get_artist_info, fn {:musicbrainz_id, ^artist_musicbrainz_id},
|
||||||
_config ->
|
_config ->
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
|
|||||||
use MusicLibraryWeb.ConnCase
|
use MusicLibraryWeb.ConnCase
|
||||||
|
|
||||||
import MusicLibrary.RecordsFixtures
|
import MusicLibrary.RecordsFixtures
|
||||||
import LastFm.Fixtures
|
import LastFm.Fixtures.Artist
|
||||||
import Mox
|
import Mox
|
||||||
|
|
||||||
alias LastFm.APIBehaviourMock
|
alias LastFm.APIBehaviourMock
|
||||||
@@ -30,7 +30,7 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
|
|||||||
} do
|
} do
|
||||||
expect(APIBehaviourMock, :get_artist_info, fn {:musicbrainz_id, ^artist_musicbrainz_id},
|
expect(APIBehaviourMock, :get_artist_info, fn {:musicbrainz_id, ^artist_musicbrainz_id},
|
||||||
_config ->
|
_config ->
|
||||||
{:ok, artist_get_info()}
|
{:ok, get_info()}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
defmodule LastFm.Fixtures do
|
defmodule LastFm.Fixtures.Artist do
|
||||||
@fixtures_folder Path.join([File.cwd!(), "test/support/fixtures"])
|
@fixtures_folder Path.join([File.cwd!(), "test/support/fixtures/last_fm"])
|
||||||
|
|
||||||
alias LastFm.Artist
|
alias LastFm.Artist
|
||||||
|
|
||||||
def artist_get_info do
|
def get_info do
|
||||||
Path.join([@fixtures_folder, "artist.getinfo.json"])
|
Path.join([@fixtures_folder, "artist.getinfo.json"])
|
||||||
|> File.read!()
|
|> File.read!()
|
||||||
|> JSON.decode!()
|
|> JSON.decode!()
|
||||||
Reference in New Issue
Block a user