Include a shared Last.FM api key, providing zero conf ArtistInfo (bio/top songs/similar artists)

This commit is contained in:
Deluan
2021-05-27 16:14:24 -04:00
parent db11b6b8f8
commit b398053223
5 changed files with 50 additions and 10 deletions
+28
View File
@@ -0,0 +1,28 @@
package agents
import (
"context"
"github.com/navidrome/navidrome/conf"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("lastfmAgent", func() {
Describe("lastFMConstructor", func() {
It("uses default api key and language if not configured", func() {
conf.Server.LastFM.ApiKey = ""
agent := lastFMConstructor(context.TODO())
Expect(agent.(*lastfmAgent).apiKey).To(Equal(lastFMAPIKey))
Expect(agent.(*lastfmAgent).lang).To(Equal("en"))
})
It("uses configured api key and language", func() {
conf.Server.LastFM.ApiKey = "123"
conf.Server.LastFM.Language = "pt"
agent := lastFMConstructor(context.TODO())
Expect(agent.(*lastfmAgent).apiKey).To(Equal("123"))
Expect(agent.(*lastfmAgent).lang).To(Equal("pt"))
})
})
})