Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mmorgantaylor committed Sep 6, 2024
1 parent c0d3af9 commit cfad601
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,22 @@ void generatePutObjectSignedUrl() throws MalformedURLException {
assertEquals(fakeURL, generatedURL);
}

@Test
void generateGetObjectSignedUrl() throws MalformedURLException {
URL fakeURL = new URL("https://storage.googleapis.com/signed-url-stuff");
when(mockStorageService.signUrl(
any(BlobInfo.class),
anyLong(),
any(TimeUnit.class),
any(Storage.SignUrlOption.class),
any(Storage.SignUrlOption.class)))
.thenReturn(fakeURL);

URL generatedURL =
gcsService.generateGetObjectSignedUrl("projectId", "bucketName", "objectName");
assertEquals(fakeURL, generatedURL);
}

@Test
void socketExceptionRetriesEventuallySucceed() throws Exception {
URL fakeURL = new URL("https://storage.googleapis.com/signed-url-stuff");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,25 @@ void upsertDataTableEntity() throws Exception {
assertEquals(expectedResponse, rawlsService.upsertDataTableEntity(any(), any(), any(), any()));
}

@Test
void getDataTableEntity() throws Exception {
Entity expectedResponse = new Entity().name("entityName").entityType("entityType");

rawlsClient = mock(RawlsClient.class);
EntitiesApi entitiesApi = mock(EntitiesApi.class);
when(entitiesApi.getEntity(any(), any(), any(), any(), any(), any()))
.thenReturn(expectedResponse);

rawlsService = spy(new RawlsService(rawlsClient, template));

doReturn(entitiesApi).when(rawlsClient).getEntitiesApi(any());

assertEquals(
expectedResponse,
rawlsService.getDataTableEntity(
"token", "billingProject", "workspace", "entityType", "entityName"));
}

@Test
void submissionIsNotRunning() {
assertFalse(RawlsService.submissionIsRunning(new Submission().status(SubmissionStatus.DONE)));
Expand Down

0 comments on commit cfad601

Please sign in to comment.