|
1 | 1 | package net.snowflake.client.core; |
2 | 2 |
|
3 | 3 | import static org.hamcrest.MatcherAssert.assertThat; |
4 | | -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
5 | 4 | import static org.junit.jupiter.api.Assertions.assertEquals; |
6 | 5 | import static org.junit.jupiter.api.Assertions.assertFalse; |
7 | | -import static org.junit.jupiter.api.Assertions.assertThrows; |
8 | 6 | import static org.junit.jupiter.api.Assertions.assertTrue; |
9 | 7 | import static org.junit.jupiter.api.Assertions.fail; |
10 | | -import static org.mockito.Mockito.mockStatic; |
11 | 8 |
|
12 | 9 | import com.fasterxml.jackson.databind.ObjectMapper; |
13 | 10 | import com.fasterxml.jackson.databind.node.BooleanNode; |
|
18 | 15 | import java.util.HashMap; |
19 | 16 | import java.util.List; |
20 | 17 | import java.util.Map; |
21 | | -import net.snowflake.client.core.auth.AuthenticatorType; |
22 | 18 | import net.snowflake.client.jdbc.MockConnectionTest; |
23 | | -import net.snowflake.client.jdbc.SnowflakeUtil; |
24 | 19 | import org.apache.http.client.methods.HttpPost; |
25 | 20 | import org.apache.http.client.utils.URIBuilder; |
26 | 21 | import org.junit.jupiter.api.AfterAll; |
27 | 22 | import org.junit.jupiter.api.BeforeAll; |
28 | 23 | import org.junit.jupiter.api.Test; |
29 | | -import org.mockito.MockedStatic; |
30 | 24 |
|
31 | 25 | public class SessionUtilTest { |
32 | 26 | private static String originalUrlValue; |
@@ -250,48 +244,6 @@ public void testGetCommonParams() throws Exception { |
250 | 244 | assertEquals("value", result.get("TIMEZONE")); |
251 | 245 | } |
252 | 246 |
|
253 | | - @Test |
254 | | - public void shouldProperlyCheckIfExperimentalAuthEnabled() { |
255 | | - try (MockedStatic<SnowflakeUtil> snowflakeUtilMockedStatic = mockStatic(SnowflakeUtil.class)) { |
256 | | - snowflakeUtilMockedStatic |
257 | | - .when(() -> SnowflakeUtil.systemGetEnv("SF_ENABLE_EXPERIMENTAL_AUTHENTICATION")) |
258 | | - .thenReturn(null); |
259 | | - assertDoesNotThrow( |
260 | | - () -> |
261 | | - SessionUtil.checkIfExperimentalAuthnEnabled( |
262 | | - AuthenticatorType.OAUTH_AUTHORIZATION_CODE)); |
263 | | - assertDoesNotThrow( |
264 | | - () -> |
265 | | - SessionUtil.checkIfExperimentalAuthnEnabled( |
266 | | - AuthenticatorType.OAUTH_CLIENT_CREDENTIALS)); |
267 | | - assertDoesNotThrow( |
268 | | - () -> |
269 | | - SessionUtil.checkIfExperimentalAuthnEnabled( |
270 | | - AuthenticatorType.PROGRAMMATIC_ACCESS_TOKEN)); |
271 | | - assertThrows( |
272 | | - SFException.class, |
273 | | - () -> SessionUtil.checkIfExperimentalAuthnEnabled(AuthenticatorType.WORKLOAD_IDENTITY)); |
274 | | - |
275 | | - snowflakeUtilMockedStatic |
276 | | - .when(() -> SnowflakeUtil.systemGetEnv("SF_ENABLE_EXPERIMENTAL_AUTHENTICATION")) |
277 | | - .thenReturn("true"); |
278 | | - assertDoesNotThrow( |
279 | | - () -> |
280 | | - SessionUtil.checkIfExperimentalAuthnEnabled( |
281 | | - AuthenticatorType.OAUTH_AUTHORIZATION_CODE)); |
282 | | - assertDoesNotThrow( |
283 | | - () -> |
284 | | - SessionUtil.checkIfExperimentalAuthnEnabled( |
285 | | - AuthenticatorType.OAUTH_CLIENT_CREDENTIALS)); |
286 | | - assertDoesNotThrow( |
287 | | - () -> |
288 | | - SessionUtil.checkIfExperimentalAuthnEnabled( |
289 | | - AuthenticatorType.PROGRAMMATIC_ACCESS_TOKEN)); |
290 | | - assertDoesNotThrow( |
291 | | - () -> SessionUtil.checkIfExperimentalAuthnEnabled(AuthenticatorType.WORKLOAD_IDENTITY)); |
292 | | - } |
293 | | - } |
294 | | - |
295 | 247 | private void resetOcspConfiguration() { |
296 | 248 | SFTrustManager.SF_OCSP_RESPONSE_CACHE_SERVER_URL_VALUE = null; |
297 | 249 | SFTrustManager.SF_OCSP_RESPONSE_CACHE_SERVER_RETRY_URL_PATTERN = null; |
|
0 commit comments