mirror of
https://github.com/sstent/go-garth.git
synced 2026-01-26 09:03:00 +00:00
Refactor: Complete authentication flow changes
This commit includes the remaining files from the authentication flow refactoring.\nThese changes were part of the initial diff between c00ea67f31 and HEAD,\nand complete the transition to the new SSO and OAuth-based authentication mechanism.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package client_test
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"testing"
|
||||
@@ -16,7 +17,7 @@ import (
|
||||
|
||||
func TestClient_GetUserProfile(t *testing.T) {
|
||||
// Create mock server returning user profile
|
||||
server := testutils.MockJSONResponse(http.StatusOK, `{
|
||||
server := testutils.MockJSONResponse(http.StatusOK, `{
|
||||
"userName": "testuser",
|
||||
"displayName": "Test User",
|
||||
"fullName": "Test User",
|
||||
@@ -28,7 +29,12 @@ func TestClient_GetUserProfile(t *testing.T) {
|
||||
u, _ := url.Parse(server.URL)
|
||||
c, err := client.NewClient(u.Host)
|
||||
require.NoError(t, err)
|
||||
c.HTTPClient = &http.Client{Timeout: 5 * time.Second}
|
||||
c.HTTPClient = &http.Client{
|
||||
Timeout: 5 * time.Second,
|
||||
Transport: &http.Transport{
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
},
|
||||
}
|
||||
c.AuthToken = "Bearer testtoken"
|
||||
|
||||
// Get user profile
|
||||
@@ -38,4 +44,4 @@ func TestClient_GetUserProfile(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "testuser", profile.UserName)
|
||||
assert.Equal(t, "Test User", profile.DisplayName)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user