Rename APIBehaviourMock -> APIMock
This commit is contained in:
@@ -5,7 +5,7 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
|
||||
import LastFm.Fixtures.Artist
|
||||
import Mox
|
||||
|
||||
alias LastFm.APIBehaviourMock
|
||||
alias LastFm.APIMock
|
||||
|
||||
setup :verify_on_exit!
|
||||
|
||||
@@ -28,8 +28,7 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
|
||||
conn: conn,
|
||||
artist_musicbrainz_id: artist_musicbrainz_id
|
||||
} do
|
||||
expect(APIBehaviourMock, :get_artist_info, fn {:musicbrainz_id, ^artist_musicbrainz_id},
|
||||
_config ->
|
||||
expect(APIMock, :get_artist_info, fn {:musicbrainz_id, ^artist_musicbrainz_id}, _config ->
|
||||
{:ok, get_info()}
|
||||
end)
|
||||
|
||||
@@ -45,8 +44,7 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
|
||||
conn: conn,
|
||||
artist_musicbrainz_id: artist_musicbrainz_id
|
||||
} do
|
||||
expect(APIBehaviourMock, :get_artist_info, fn {:musicbrainz_id, ^artist_musicbrainz_id},
|
||||
_config ->
|
||||
expect(APIMock, :get_artist_info, fn {:musicbrainz_id, ^artist_musicbrainz_id}, _config ->
|
||||
{:error, :timeout}
|
||||
end)
|
||||
|
||||
@@ -74,8 +72,7 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
|
||||
record_with_artist("Porcupine Tree", %{purchased_at: DateTime.utc_now()})
|
||||
|
||||
# for this test, we don't care about the artist info, but we mock it to avoid false test failures
|
||||
expect(APIBehaviourMock, :get_artist_info, fn {:musicbrainz_id, ^artist_musicbrainz_id},
|
||||
_config ->
|
||||
expect(APIMock, :get_artist_info, fn {:musicbrainz_id, ^artist_musicbrainz_id}, _config ->
|
||||
{:error, :timeout}
|
||||
end)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
|
||||
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
|
||||
import Mox
|
||||
alias MusicLibrary.Records.{Cover, Record}
|
||||
alias MusicBrainz.APIBehaviourMock
|
||||
alias MusicBrainz.APIMock
|
||||
|
||||
setup :verify_on_exit!
|
||||
|
||||
@@ -244,9 +244,9 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
|
||||
test "it imports a record when selected", %{conn: conn} do
|
||||
mock_results = release_group_search_results()
|
||||
|
||||
expect(APIBehaviourMock, :search_release_group, fn "Marillion Marbles",
|
||||
[limit: 10, offset: 0],
|
||||
_config ->
|
||||
expect(APIMock, :search_release_group, fn "Marillion Marbles",
|
||||
[limit: 10, offset: 0],
|
||||
_config ->
|
||||
{:ok, mock_results}
|
||||
end)
|
||||
|
||||
@@ -267,17 +267,17 @@ defmodule MusicLibraryWeb.CollectionLive.IndexTest do
|
||||
|
||||
release_group = release_group(:marbles)
|
||||
|
||||
expect(APIBehaviourMock, :get_release_group, fn ^first_result_id, _config ->
|
||||
expect(APIMock, :get_release_group, fn ^first_result_id, _config ->
|
||||
{:ok, release_group}
|
||||
end)
|
||||
|
||||
expect(APIBehaviourMock, :get_releases, fn ^first_result_id, _opts, _config ->
|
||||
expect(APIMock, :get_releases, fn ^first_result_id, _opts, _config ->
|
||||
{:ok, %{"releases" => release_group["releases"]}}
|
||||
end)
|
||||
|
||||
cover_data = File.read!(marbles_cover_fixture())
|
||||
|
||||
expect(APIBehaviourMock, :get_cover_art, fn {:musicbrainz_id, ^first_result_id}, _config ->
|
||||
expect(APIMock, :get_cover_art, fn {:musicbrainz_id, ^first_result_id}, _config ->
|
||||
{:ok, cover_data}
|
||||
end)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ defmodule MusicLibraryWeb.StatsLive.IndexTest do
|
||||
use MusicLibraryWeb.ConnCase
|
||||
|
||||
alias MusicLibrary.{Records, Repo, Wishlist}
|
||||
alias MusicBrainz.APIBehaviourMock
|
||||
alias MusicBrainz.APIMock
|
||||
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
|
||||
import MusicLibrary.Fixtures.Records
|
||||
import MusicLibrary.Fixtures.ReleaseGroup
|
||||
@@ -186,22 +186,22 @@ defmodule MusicLibraryWeb.StatsLive.IndexTest do
|
||||
release_group = release_group(:mystery_of_time)
|
||||
release_group_id = release_group_id(:mystery_of_time)
|
||||
|
||||
expect(APIBehaviourMock, :get_release, fn ^release_id, _config ->
|
||||
expect(APIMock, :get_release, fn ^release_id, _config ->
|
||||
{:ok, release}
|
||||
end)
|
||||
|
||||
expect(APIBehaviourMock, :get_release_group, fn ^release_group_id, _config ->
|
||||
expect(APIMock, :get_release_group, fn ^release_group_id, _config ->
|
||||
{:ok, release_group}
|
||||
end)
|
||||
|
||||
expect(APIBehaviourMock, :get_releases, fn ^release_group_id, _opts, _config ->
|
||||
expect(APIMock, :get_releases, fn ^release_group_id, _opts, _config ->
|
||||
{:ok, %{"releases" => release_group["releases"]}}
|
||||
end)
|
||||
|
||||
# Doesn't matter if we use a different cover
|
||||
cover_data = File.read!(marbles_cover_fixture())
|
||||
|
||||
expect(APIBehaviourMock, :get_cover_art, fn {:musicbrainz_id, ^release_group_id}, _config ->
|
||||
expect(APIMock, :get_cover_art, fn {:musicbrainz_id, ^release_group_id}, _config ->
|
||||
{:ok, cover_data}
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user