Skip to content

Commit 9ce45ef

Browse files
remove unnecessary test
1 parent c4433de commit 9ce45ef

File tree

1 file changed

+0
-63
lines changed

1 file changed

+0
-63
lines changed

databricks-sdk-java/src/test/java/com/databricks/sdk/core/oauth/ExternalBrowserCredentialsProviderTest.java

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -488,67 +488,4 @@ void cacheWithInvalidTokensTest() throws IOException {
488488
// Verify token was saved after browser auth (for the new token)
489489
Mockito.verify(mockTokenCache, Mockito.times(1)).save(any(Token.class));
490490
}
491-
492-
@Test
493-
void disabledTokenCacheTest() throws IOException {
494-
// Create mock HTTP client for token operations
495-
HttpClient mockHttpClient = Mockito.mock(HttpClient.class);
496-
497-
// Setup browser auth result
498-
Token browserAuthToken =
499-
new Token(
500-
"browser_access_token",
501-
"Bearer",
502-
"browser_refresh_token",
503-
LocalDateTime.now().plusHours(1));
504-
505-
SessionCredentials browserAuthCreds =
506-
new SessionCredentials.Builder()
507-
.withToken(browserAuthToken)
508-
.withClientId("test-client-id")
509-
.withTokenUrl("https://test-token-url")
510-
.build();
511-
512-
// Create config with browser auth type
513-
DatabricksConfig config =
514-
new DatabricksConfig()
515-
.setAuthType("external-browser")
516-
.setHost("https://test.databricks.com")
517-
.setClientId("test-client-id")
518-
.setHttpClient(mockHttpClient);
519-
520-
// We need to provide OIDC endpoints
521-
OpenIDConnectEndpoints endpoints =
522-
new OpenIDConnectEndpoints(
523-
"https://test.databricks.com/token", "https://test.databricks.com/authorize");
524-
525-
// Create a mock token cache that simulates being disabled by returning null on load
526-
TokenCache mockTokenCache = Mockito.mock(TokenCache.class);
527-
Mockito.doReturn(null).when(mockTokenCache).load();
528-
529-
// Create our provider with the disabled token cache and mock the browser auth method
530-
ExternalBrowserCredentialsProvider provider =
531-
Mockito.spy(new ExternalBrowserCredentialsProvider(mockTokenCache));
532-
Mockito.doReturn(browserAuthCreds)
533-
.when(provider)
534-
.performBrowserAuth(any(DatabricksConfig.class), any(TokenCache.class));
535-
536-
// Spy on the config to inject the endpoints
537-
DatabricksConfig spyConfig = Mockito.spy(config);
538-
Mockito.doReturn(endpoints).when(spyConfig).getOidcEndpoints();
539-
540-
// Configure provider
541-
HeaderFactory headerFactory = provider.configure(spyConfig);
542-
543-
// Verify headers contain the browser auth token
544-
Map<String, String> headers = headerFactory.headers();
545-
assertEquals("Bearer browser_access_token", headers.get("Authorization"));
546-
547-
// Verify performBrowserAuth was called immediately (no attempt to use cache)
548-
Mockito.verify(provider, Mockito.times(1))
549-
.performBrowserAuth(any(DatabricksConfig.class), any(TokenCache.class));
550-
551-
// Verify token was saved to cache
552-
Mockito.verify(mockTokenCache, Mockito.times(1)).save(any(Token.class));
553-
}
554491
}

0 commit comments

Comments
 (0)