-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix] Handle login.html incorrect validation for private link (#340)
## Changes 1. query returned can be null, however its not handled correctly 2. checking if query is null or not before checking for error code `private-link-validation-error` ## Tests Unit Tests
- Loading branch information
1 parent
c9fb324
commit 44348af
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
databricks-sdk-java/src/test/java/com/databricks/sdk/core/error/PrivateLinkInfoTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.databricks.sdk.core.error; | ||
|
||
import com.databricks.sdk.core.error.platform.*; | ||
import com.databricks.sdk.core.http.Request; | ||
import com.databricks.sdk.core.http.Response; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class PrivateLinkInfoTest { | ||
@Test | ||
void testIsPrivateLinkRedirectWithLoginHtmlAndQueryParamSet() { | ||
Response response = | ||
new Response( | ||
new Request("GET", "https://example.com/login.html") | ||
.withQueryParam("error", "private-link-validation-error"), | ||
307, | ||
"Temporary Redirect", | ||
null); | ||
assert PrivateLinkInfo.isPrivateLinkRedirect(response) == true; | ||
} | ||
|
||
@Test | ||
void testIsPrivateLinkRedirectWithLoginHtmlAndQueryParamNotSet() { | ||
Response response = | ||
new Response( | ||
new Request("GET", "https://example.com/login.html"), 307, "Temporary Redirect", null); | ||
assert PrivateLinkInfo.isPrivateLinkRedirect(response) == false; | ||
} | ||
|
||
@Test | ||
void testIsPrivateLinkRedirectNotLoginPage() { | ||
Response response = | ||
new Response( | ||
new Request("GET", "https://example.com/not-login.html"), | ||
307, | ||
"Temporary Redirect", | ||
null); | ||
assert PrivateLinkInfo.isPrivateLinkRedirect(response) == false; | ||
} | ||
} |