MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / TestAuthManager_EnsureAuthenticated_WithToken

Function TestAuthManager_EnsureAuthenticated_WithToken

pkg/api/auth_test.go:111–127  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

109}
110
111func TestAuthManager_EnsureAuthenticated_WithToken(t *testing.T) {
112 // Create a mock HTTP client
113 httpClient := &HTTPClient{
114 baseURL: "https://test.example.com",
115 client: &http.Client{},
116 }
117 logger := testutils.NewTestLogger()
118 token := testTokenValue
119
120 authManager := NewAuthManagerWithToken(httpClient, token, logger)
121
122 err := authManager.EnsureAuthenticated()
123 assert.NoError(t, err)
124
125 // Verify that the HTTP client has the token set
126 assert.Equal(t, token, httpClient.apiToken)
127}
128
129func TestAuthManager_GetValidToken_WithAPIToken(t *testing.T) {
130 httpClient := &HTTPClient{baseURL: "https://test.example.com"}

Callers

nothing calls this directly

Calls 3

NewTestLoggerFunction · 0.92
NewAuthManagerWithTokenFunction · 0.85
EnsureAuthenticatedMethod · 0.80

Tested by

no test coverage detected