mirror of
https://git.sr.ht/~phw/scotty
synced 2025-07-02 08:11:56 +02:00
Use config.ServiceConfig across API
This commit is contained in:
parent
091b3c2f49
commit
9c363cc06d
27 changed files with 137 additions and 99 deletions
|
@ -27,13 +27,15 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uploadedlobster.com/scotty/internal/backends/spotify"
|
||||
"go.uploadedlobster.com/scotty/internal/config"
|
||||
)
|
||||
|
||||
func TestFromConfig(t *testing.T) {
|
||||
config := viper.New()
|
||||
config.Set("client-id", "someclientid")
|
||||
config.Set("client-secret", "someclientsecret")
|
||||
backend := (&spotify.SpotifyApiBackend{}).FromConfig(config)
|
||||
c := viper.New()
|
||||
c.Set("client-id", "someclientid")
|
||||
c.Set("client-secret", "someclientsecret")
|
||||
service := config.NewServiceConfig("test", c)
|
||||
backend := (&spotify.SpotifyApiBackend{}).FromConfig(&service)
|
||||
assert.IsType(t, &spotify.SpotifyApiBackend{}, backend)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue