fix(coverart/test): use newHTTPClient in provider test fixtures
This commit is contained in:
@@ -19,7 +19,7 @@ func newLastfmTestProvider(t *testing.T, baseURL, key string) *lastfmProvider {
|
||||
lastfmBaseURL = baseURL
|
||||
t.Cleanup(func() { lastfmBaseURL = prevBase })
|
||||
|
||||
p := &lastfmProvider{client: &http.Client{Timeout: 5 * time.Second}}
|
||||
p := &lastfmProvider{client: newHTTPClient(httpClientOptions{Name: "lastfm", HTTPClient: &http.Client{Timeout: 5 * time.Second}, TreatAuthAsTransient: true, BaseBackoff: time.Millisecond})}
|
||||
p.enabled.Store(true)
|
||||
p.apiKey.Store(&key)
|
||||
return p
|
||||
@@ -177,7 +177,7 @@ func TestLastfm_FetchArtistArt_ErrorResponse(t *testing.T) {
|
||||
|
||||
func TestLastfm_FetchArtistArt_EmptyAPIKey(t *testing.T) {
|
||||
// Enabled but no key: every call must return ErrNotFound, not a network error.
|
||||
p := &lastfmProvider{client: &http.Client{Timeout: 5 * time.Second}}
|
||||
p := &lastfmProvider{client: newHTTPClient(httpClientOptions{Name: "lastfm", HTTPClient: &http.Client{Timeout: 5 * time.Second}, TreatAuthAsTransient: true, BaseBackoff: time.Millisecond})}
|
||||
p.enabled.Store(true)
|
||||
emptyKey := ""
|
||||
p.apiKey.Store(&emptyKey)
|
||||
@@ -190,7 +190,7 @@ func TestLastfm_FetchArtistArt_EmptyAPIKey(t *testing.T) {
|
||||
|
||||
func TestLastfm_FetchArtistArt_Disabled(t *testing.T) {
|
||||
// Key set but disabled.
|
||||
p := &lastfmProvider{client: &http.Client{Timeout: 5 * time.Second}}
|
||||
p := &lastfmProvider{client: newHTTPClient(httpClientOptions{Name: "lastfm", HTTPClient: &http.Client{Timeout: 5 * time.Second}, TreatAuthAsTransient: true, BaseBackoff: time.Millisecond})}
|
||||
// enabled defaults to false
|
||||
key := "some-key"
|
||||
p.apiKey.Store(&key)
|
||||
@@ -203,7 +203,7 @@ func TestLastfm_FetchArtistArt_Disabled(t *testing.T) {
|
||||
|
||||
func TestLastfm_FetchArtistArt_EmptyRefs(t *testing.T) {
|
||||
// Neither MBID nor Name: ErrNotFound without making any HTTP call.
|
||||
p := &lastfmProvider{client: &http.Client{Timeout: 5 * time.Second}}
|
||||
p := &lastfmProvider{client: newHTTPClient(httpClientOptions{Name: "lastfm", HTTPClient: &http.Client{Timeout: 5 * time.Second}, TreatAuthAsTransient: true, BaseBackoff: time.Millisecond})}
|
||||
p.enabled.Store(true)
|
||||
key := "test-key"
|
||||
p.apiKey.Store(&key)
|
||||
@@ -301,7 +301,7 @@ func TestLastfm_FetchAlbumCover_WithMBIDHint(t *testing.T) {
|
||||
// ── FetchAlbumCover — missing fields ─────────────────────────────────────────
|
||||
|
||||
func TestLastfm_FetchAlbumCover_MissingFields(t *testing.T) {
|
||||
p := &lastfmProvider{client: &http.Client{Timeout: 5 * time.Second}}
|
||||
p := &lastfmProvider{client: newHTTPClient(httpClientOptions{Name: "lastfm", HTTPClient: &http.Client{Timeout: 5 * time.Second}, TreatAuthAsTransient: true, BaseBackoff: time.Millisecond})}
|
||||
p.enabled.Store(true)
|
||||
key := "test-key"
|
||||
p.apiKey.Store(&key)
|
||||
@@ -320,7 +320,7 @@ func TestLastfm_FetchAlbumCover_MissingFields(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLastfm_FetchAlbumCover_EmptyAPIKey(t *testing.T) {
|
||||
p := &lastfmProvider{client: &http.Client{Timeout: 5 * time.Second}}
|
||||
p := &lastfmProvider{client: newHTTPClient(httpClientOptions{Name: "lastfm", HTTPClient: &http.Client{Timeout: 5 * time.Second}, TreatAuthAsTransient: true, BaseBackoff: time.Millisecond})}
|
||||
p.enabled.Store(true)
|
||||
emptyKey := ""
|
||||
p.apiKey.Store(&emptyKey)
|
||||
@@ -332,7 +332,7 @@ func TestLastfm_FetchAlbumCover_EmptyAPIKey(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLastfm_FetchAlbumCover_Disabled(t *testing.T) {
|
||||
p := &lastfmProvider{client: &http.Client{Timeout: 5 * time.Second}}
|
||||
p := &lastfmProvider{client: newHTTPClient(httpClientOptions{Name: "lastfm", HTTPClient: &http.Client{Timeout: 5 * time.Second}, TreatAuthAsTransient: true, BaseBackoff: time.Millisecond})}
|
||||
// enabled defaults to false
|
||||
key := "some-key"
|
||||
p.apiKey.Store(&key)
|
||||
|
||||
Reference in New Issue
Block a user