Skip to content

Commit

Permalink
update test data, test helpers, and a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
raejohanek committed Aug 21, 2024
1 parent 62aa63a commit d45f934
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,10 @@ public SnapshotCreateFlight(FlightMap inputParameters, Object applicationContext
IamResourceType.DATASET,
"A snapshot was created from this dataset."));

// on the snapshot request, save information about the created snapshot and about
// the Sam group that was added as a DAC.
if (mode == SnapshotRequestContentsModel.ModeEnum.BYREQUESTID) {
UUID snapshotRequestId = contents.getRequestIdSpec().getSnapshotRequestId();
// Add created snapshot id to the snapshot request.
// On the snapshot access request, save information about the created snapshot and about
// the Sam group that was added as a DAC.
addStep(
new AddCreatedInfoToSnapshotRequestStep(
snapshotRequestDao, snapshotRequestId, snapshotId, tdrServiceAccountEmail));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,15 +449,16 @@ public static SnapshotRequestModel createSnapshotRequestByRequestId(
}

public static SnapshotAccessRequestModel createAccessRequestModelApproved() {
SnapshotAccessRequest request = createSnapshotAccessRequest(UUID.randomUUID());
return new SnapshotAccessRequestModel(
UUID.randomUUID(),
request.getName(),
request.getResearchPurposeStatement(),
request.getSourceSnapshotId(),
null,
null,
UUID.randomUUID(),
null,
"email@a.com",
null,
null,
"user@gmail.com",
Instant.now(),
Instant.now(),
SnapshotAccessRequestStatus.APPROVED,
null,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ private SnapshotAccessRequestModel createRequest(SnapshotAccessRequest snapshotA
return snapshotRequestDao.create(snapshotAccessRequest, EMAIL);
}

private void verifyResponseContents(SnapshotAccessRequestModel response) {
verifyResponseContents(response, List.of());
}

private void verifyResponseContents(
SnapshotAccessRequestModel response, List<String> ignoredFields) {
SnapshotAccessRequestModel expected =
Expand All @@ -96,7 +100,7 @@ private void verifyResponseContents(
void getById() {
SnapshotAccessRequestModel response = createRequest();
SnapshotAccessRequestModel retrieved = snapshotRequestDao.getById(response.id());
verifyResponseContents(retrieved, List.of());
verifyResponseContents(retrieved);
}

@Test
Expand Down Expand Up @@ -179,7 +183,7 @@ void enumerateNotFound() {
@Test
void create() {
SnapshotAccessRequestModel response = createRequest();
verifyResponseContents(response, List.of());
verifyResponseContents(response);

SnapshotAccessRequestModel response1 = snapshotRequestDao.create(snapshotAccessRequest, EMAIL);

Expand All @@ -206,7 +210,7 @@ void createSnapshotIdNotFound() {
void updateStatus() {
SnapshotAccessRequestModel response = createRequest();
assertNull(response.statusUpdatedDate(), "Status was never updated.");
verifyResponseContents(response, List.of());
verifyResponseContents(response);
snapshotRequestDao.updateStatus(response.id(), SnapshotAccessRequestStatus.APPROVED);
SnapshotAccessRequestModel updatedResponse = snapshotRequestDao.getById(response.id());
assertThat(
Expand All @@ -230,7 +234,7 @@ void updateStatusIdNotFound() {
@Test
void updateFlightId() {
SnapshotAccessRequestModel response = createRequest();
verifyResponseContents(response, List.of());
verifyResponseContents(response);
snapshotRequestDao.updateFlightId(response.id(), FLIGHT_ID);
SnapshotAccessRequestModel updatedResponse = snapshotRequestDao.getById(response.id());

Expand All @@ -252,7 +256,7 @@ void updateFlightIdNotFound() {
@Test
void updateCreatedInfo() {
SnapshotAccessRequestModel response = createRequest();
verifyResponseContents(response, List.of());
verifyResponseContents(response);
snapshotRequestDao.updateCreatedInfo(
response.id(), createdSnapshot.getId(), SAM_GROUP_NAME, SAM_GROUP_CREATED_BY);
SnapshotAccessRequestModel updatedResponse = snapshotRequestDao.getById(response.id());
Expand Down

0 comments on commit d45f934

Please sign in to comment.