add initial Last.FM tests (#329)

* Move model into separate file

* Separate Last.FM client and scrobbler

* Use separate Last.FM client and scrobbler

* Fix playcount attribute name

* Add initial test for Last.FM client
This commit is contained in:
Gregor Zurowski
2023-05-20 13:24:03 +02:00
committed by GitHub
parent 6144ac7979
commit dbcccdc811
12 changed files with 572 additions and 359 deletions

View File

@@ -20,7 +20,6 @@ import (
"go.senan.xyz/gonic/db"
"go.senan.xyz/gonic/scanner"
"go.senan.xyz/gonic/scrobble/lastfm"
"go.senan.xyz/gonic/scrobble/listenbrainz"
"go.senan.xyz/gonic/transcode"
)
@@ -106,7 +105,7 @@ func (c *Controller) ServeLinkLastFMDo(r *http.Request) *Response {
if err != nil {
return &Response{redirect: r.Referer(), flashW: []string{fmt.Sprintf("couldn't get secret: %v", err)}}
}
sessionKey, err := lastfm.GetSession(apiKey, secret, token)
sessionKey, err := c.lastfmClient.GetSession(apiKey, secret, token)
if err != nil {
return &Response{
redirect: "/admin/home",