mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 00:47:11 +02:00
Add helper methods to DatastoreAdmin Operation object
These are needed by Datastore export management actions. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=224242281
This commit is contained in:
parent
a612e9bf66
commit
7d380256af
8 changed files with 164 additions and 7 deletions
|
@ -134,6 +134,23 @@ public class DatastoreAdminTest {
|
|||
assertThat(getAccessToken(httpRequest)).hasValue(ACCESS_TOKEN);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListOperations_filterByState() throws IOException {
|
||||
// TODO(weiminyu): consider adding a method to DatastoreAdmin to support query by state.
|
||||
DatastoreAdmin.ListOperations listOperations =
|
||||
datastoreAdmin.list("metadata.common.state=PROCESSING");
|
||||
HttpRequest httpRequest = listOperations.buildHttpRequest();
|
||||
assertThat(httpRequest.getUrl().toString())
|
||||
.isEqualTo(
|
||||
"https://datastore.googleapis.com/v1/projects/MyCloudProject/operations"
|
||||
+ "?filter=metadata.common.state%3DPROCESSING");
|
||||
assertThat(httpRequest.getRequestMethod()).isEqualTo("GET");
|
||||
assertThat(httpRequest.getContent()).isNull();
|
||||
|
||||
simulateSendRequest(httpRequest);
|
||||
assertThat(getAccessToken(httpRequest)).hasValue(ACCESS_TOKEN);
|
||||
}
|
||||
|
||||
private static HttpRequest simulateSendRequest(HttpRequest httpRequest) {
|
||||
try {
|
||||
httpRequest.setUrl(new GenericUrl("https://localhost:65537")).execute();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue