nastra commented on code in PR #11992:
URL: https://github.com/apache/iceberg/pull/11992#discussion_r1922258470
##########
core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java:
##########
@@ -1324,89 +1222,67 @@ public void testTableAuth(
Mockito.verify(adapter)
.execute(
- eq(HTTPMethod.GET),
- eq("v1/config"),
- any(),
- any(),
+ reqMatcher(HTTPMethod.GET, "v1/config", catalogHeaders),
eq(ConfigResponse.class),
- eq(catalogHeaders),
+ any(),
any());
// session client credentials flow
Mockito.verify(adapter)
.execute(
- eq(HTTPMethod.POST),
- eq(oauth2ServerUri),
- any(),
- any(),
+ reqMatcher(HTTPMethod.POST, oauth2ServerUri, catalogHeaders),
eq(OAuthTokenResponse.class),
- eq(catalogHeaders),
+ any(),
any());
// create table request
Mockito.verify(adapter)
.execute(
- eq(HTTPMethod.POST),
- eq("v1/namespaces/ns/tables"),
- any(),
- any(),
+ reqMatcher(HTTPMethod.POST, "v1/namespaces/ns/tables",
expectedContextHeaders),
eq(LoadTableResponse.class),
- eq(expectedContextHeaders),
+ any(),
any());
// if the table returned a bearer token or a credential, there will be no
token request
if (!tableConfig.containsKey("token") &&
!tableConfig.containsKey("credential")) {
// token exchange to get a table token
Mockito.verify(adapter, times(1))
.execute(
- eq(HTTPMethod.POST),
- eq(oauth2ServerUri),
- any(),
- any(),
+ reqMatcher(HTTPMethod.POST, oauth2ServerUri,
expectedContextHeaders),
eq(OAuthTokenResponse.class),
- eq(expectedContextHeaders),
+ any(),
any());
}
if (expectedContextHeaders.equals(expectedTableHeaders)) {
// load table from catalog + refresh loaded table
Mockito.verify(adapter, times(2))
.execute(
- eq(HTTPMethod.GET),
- eq("v1/namespaces/ns/tables/table"),
- any(),
- any(),
+ reqMatcher(HTTPMethod.GET, "v1/namespaces/ns/tables/table",
expectedTableHeaders),
eq(LoadTableResponse.class),
- eq(expectedTableHeaders),
+ any(),
any());
} else {
// load table from catalog
Mockito.verify(adapter)
.execute(
- eq(HTTPMethod.GET),
- eq("v1/namespaces/ns/tables/table"),
- any(),
- any(),
+ reqMatcher(HTTPMethod.GET, "v1/namespaces/ns/tables/table",
expectedContextHeaders),
eq(LoadTableResponse.class),
- eq(expectedContextHeaders),
+ any(),
any());
// refresh loaded table
Mockito.verify(adapter)
.execute(
- eq(HTTPMethod.GET),
- eq("v1/namespaces/ns/tables/table"),
- any(),
- any(),
+ reqMatcher(HTTPMethod.GET, "v1/namespaces/ns/tables/table",
expectedTableHeaders),
eq(LoadTableResponse.class),
- eq(expectedTableHeaders),
+ any(),
any());
}
}
@ParameterizedTest
@ValueSource(strings = {"v1/oauth/tokens", "https://auth-server.com/token"})
public void testCatalogTokenRefresh(String oauth2ServerUri) {
- Map<String, String> emptyHeaders = ImmutableMap.of();
Review Comment:
same as above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]