Skip to content

Commit

Permalink
Add Unit Test
Browse files Browse the repository at this point in the history
  • Loading branch information
satviksr-db committed Aug 30, 2024
1 parent fc0e957 commit bee2c57
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,24 @@ public void testDiscoveryEndpoint() throws IOException {
assertEquals(oidcEndpoints.getTokenEndpoint(), "https://test.auth.endpoint/oidc/v1/token");
}
}

@Test
public void testNewWithWorkspaceHost() {
DatabricksConfig config =
new DatabricksConfig()
.setAuthType("oauth-m2m")
.setClientId("my-client-id")
.setClientSecret("my-client-secret")
.setAccountId("account-id")
.setHost("https://account.cloud.databricks.com");
String workspaceHost = "https://workspace.cloud.databricks.com";

DatabricksConfig newWorkspaceConfig = config.newWithWorkspaceHost(workspaceHost);

assert newWorkspaceConfig.getHost().equals(workspaceHost);
assert newWorkspaceConfig.getAuthType().equals("oauth-m2m");
assert newWorkspaceConfig.getClientId().equals("my-client-id");
assert newWorkspaceConfig.getClientSecret().equals("my-client-secret");
assert newWorkspaceConfig.getAccountId() == null;
}
}

0 comments on commit bee2c57

Please sign in to comment.