Skip to content

Commit

Permalink
fix: address incorrect universe domain validation when quota project …
Browse files Browse the repository at this point in the history
…id is set
  • Loading branch information
mpeddada1 committed Sep 30, 2024
1 parent f1f7e96 commit 97b73e7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,9 @@ public boolean hasRequestMetadataOnly() {
public void refresh() throws IOException {
this.wrappedCredentials.refresh();
}

@Override
public String getUniverseDomain() throws IOException {
return this.wrappedCredentials.getUniverseDomain();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,15 @@ void quotaProjectIdHidingCredentials_getAuthenticationType() throws IOException

Mockito.verify(credentials, Mockito.atLeastOnce()).refresh();
}

@Test
void quotaProjectIdHidingCredentials_getUniverseDomain() throws IOException {
Credentials credentials = Mockito.mock(GoogleCredentials.class);
Mockito.when(credentials.getUniverseDomain()).thenReturn("example.com");

QuotaProjectIdHidingCredentials quotaProjectIdHidingCredentials =
new QuotaProjectIdHidingCredentials(credentials);

assertEquals(quotaProjectIdHidingCredentials.getUniverseDomain(), "example.com");
}
}

0 comments on commit 97b73e7

Please sign in to comment.