(t *testing.T)
| 143 | } |
| 144 | |
| 145 | func TestAuthManager_GetValidToken_WithCachedToken(t *testing.T) { |
| 146 | httpClient := &HTTPClient{baseURL: "https://test.example.com"} |
| 147 | logger := testutils.NewTestLogger() |
| 148 | |
| 149 | authManager := NewAuthManagerWithPassword(httpClient, "user", "pass", logger) |
| 150 | |
| 151 | // Set a valid cached token |
| 152 | cachedToken := &AuthToken{ |
| 153 | Ticket: "cached-ticket", |
| 154 | CSRFToken: "cached-csrf", |
| 155 | Username: "testuser", |
| 156 | ExpiresAt: time.Now().Add(1 * time.Hour), |
| 157 | } |
| 158 | authManager.authToken = cachedToken |
| 159 | |
| 160 | token, err := authManager.GetValidToken(context.Background()) |
| 161 | require.NoError(t, err) |
| 162 | assert.Equal(t, cachedToken, token) |
| 163 | } |
| 164 | |
| 165 | func TestAuthManager_GetValidToken_WithExpiredToken(t *testing.T) { |
| 166 | // Create a test server that returns a successful authentication response |
nothing calls this directly
no test coverage detected