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

Function TestAuthManager_GetValidToken_WithAPIToken

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

Source from the content-addressed store, hash-verified

127}
128
129func TestAuthManager_GetValidToken_WithAPIToken(t *testing.T) {
130 httpClient := &HTTPClient{baseURL: "https://test.example.com"}
131 logger := testutils.NewTestLogger()
132 apiToken := testTokenValue
133
134 authManager := NewAuthManagerWithToken(httpClient, apiToken, logger)
135
136 token, err := authManager.GetValidToken(context.Background())
137 require.NoError(t, err)
138 assert.NotNil(t, token)
139 assert.Equal(t, apiToken, token.Ticket)
140 assert.Equal(t, "", token.CSRFToken)
141 assert.Equal(t, "api-token", token.Username)
142 assert.True(t, token.IsValid())
143}
144
145func TestAuthManager_GetValidToken_WithCachedToken(t *testing.T) {
146 httpClient := &HTTPClient{baseURL: "https://test.example.com"}

Callers

nothing calls this directly

Calls 4

NewTestLoggerFunction · 0.92
NewAuthManagerWithTokenFunction · 0.85
GetValidTokenMethod · 0.80
IsValidMethod · 0.80

Tested by

no test coverage detected