add unit tests for ListenBrainz scrobbler (#317)

* Access HTTP client via interface to allow for testing

* [Minor] Fix typo

* Add initial test cases for ListenBrainz scrobbler

* Fix linter error for insecure TLS in tests

* Use Testify for unit tests

* Move model into separate file

* Embed JSON responses into tests

* [Minor] Fix test function names
This commit is contained in:
Gregor Zurowski
2023-05-13 14:10:11 +02:00
committed by GitHub
parent 05b2b469dc
commit bb8507a72f
7 changed files with 212 additions and 26 deletions

4
go.mod
View File

@@ -30,6 +30,7 @@ require (
github.com/philippta/go-template v0.0.0-20220911145045-4556aca435e4
github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be
github.com/sentriz/gormstore v0.0.0-20220105134332-64e31f7f6981
github.com/stretchr/testify v1.8.1
golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2
golang.org/x/net v0.7.0
gopkg.in/gormigrate.v1 v1.6.0
@@ -39,6 +40,7 @@ require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/PuerkitoBio/goquery v1.8.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/swag v0.21.1 // indirect
@@ -56,10 +58,12 @@ require (
github.com/mmcdole/goxpp v1.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/crypto v0.6.0 // indirect
golang.org/x/image v0.5.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)