mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
30 lines
713 B
Go
30 lines
713 B
Go
package oidc
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestHttpClient(t *testing.T) {
|
|
t.Run("DefaultClient", func(t *testing.T) {
|
|
client := HttpClient(false)
|
|
|
|
assert.IsType(t, http.DefaultClient, client)
|
|
assert.IsType(t, nil, client.Transport)
|
|
})
|
|
t.Run("LoggingProxyClient", func(t *testing.T) {
|
|
client := HttpClient(true)
|
|
|
|
assert.IsType(t, LoggingRoundTripper{}, client.Transport)
|
|
})
|
|
t.Run("GetRequest", func(t *testing.T) {
|
|
req, err := http.NewRequest("GET", "https://accounts.google.com/.well-known/openid-configuration", nil)
|
|
assert.Nil(t, err)
|
|
rt := LoggingRoundTripper{http.DefaultTransport}
|
|
_, err = rt.RoundTrip(req)
|
|
assert.Nil(t, err)
|
|
})
|
|
}
|