* Remove cache, pass headers in request, simplify client creation * Add test for http options creation
28 lines
874 B
Go
28 lines
874 B
Go
package buffered
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/grafana/grafana-azure-sdk-go/azsettings"
|
|
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
|
"github.com/grafana/grafana/pkg/infra/log/logtest"
|
|
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestCreateTransportOptions(t *testing.T) {
|
|
t.Run("creates correct options object", func(t *testing.T) {
|
|
settings := backend.DataSourceInstanceSettings{
|
|
BasicAuthEnabled: false,
|
|
BasicAuthUser: "",
|
|
JSONData: []byte(`{"httpHeaderName1": "foo"}`),
|
|
DecryptedSecureJSONData: map[string]string{
|
|
"httpHeaderValue1": "bar",
|
|
},
|
|
}
|
|
opts, err := CreateTransportOptions(settings, &azsettings.AzureSettings{}, featuremgmt.WithFeatures(), &logtest.Fake{})
|
|
require.NoError(t, err)
|
|
require.Equal(t, map[string]string{"foo": "bar"}, opts.Headers)
|
|
})
|
|
}
|