Use config.ServiceConfig across API

This commit is contained in:
Philipp Wolfer 2023-12-07 23:44:58 +01:00
parent 091b3c2f49
commit 9c363cc06d
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
27 changed files with 137 additions and 99 deletions

View file

@ -24,13 +24,15 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/internal/backends/funkwhale"
"go.uploadedlobster.com/scotty/internal/config"
"go.uploadedlobster.com/scotty/internal/models"
)
func TestFromConfig(t *testing.T) {
config := viper.New()
config.Set("token", "thetoken")
backend := (&funkwhale.FunkwhaleApiBackend{}).FromConfig(config)
c := viper.New()
c.Set("token", "thetoken")
service := config.NewServiceConfig("test", c)
backend := (&funkwhale.FunkwhaleApiBackend{}).FromConfig(&service)
assert.IsType(t, &funkwhale.FunkwhaleApiBackend{}, backend)
}