use of com.github.springtestdbunit.annotation.ExpectedDatabases in project ArachneCentralAPI by OHDSI.
the class AnalysisLockingControllerTests method testUnlockRequest.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetups({ @DatabaseSetup("/data/study/study-participant-with-contributor-and-leader-before.xml"), @DatabaseSetup("/data/analysis/analysis-after-locking.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-participant-with-contributor-and-leader-before.xml", assertionMode = NON_STRICT), @ExpectedDatabase(value = "/data/analysis/analysis-after-locking.xml", assertionMode = NON_STRICT), @ExpectedDatabase(value = "/data/analysis/analysis-unlock-requests.xml", assertionMode = NON_STRICT) })
public void testUnlockRequest() throws Exception {
AnalysisUnlockRequestDTO requestDTO = new AnalysisUnlockRequestDTO();
requestDTO.setDescription("please unlock");
mvc.perform(post("/api/v1/analysis-management/analyses/{analysisId}/unlock-request", ANALYSIS_ID).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(requestDTO))).andExpect(NO_ERROR_CODE);
}
use of com.github.springtestdbunit.annotation.ExpectedDatabases in project ArachneCentralAPI by OHDSI.
the class AnalysisSubmissionControllerTests method testDeclineSubmissionByOwner.
@Test
@WithUserDetails(DATA_NODE_ONWER)
@DatabaseSetups({ @DatabaseSetup("/data/analysis/submission/submission-pending.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/analysis/submission/result/submission-datasource2-declined.xml", assertionMode = NON_STRICT) })
public void testDeclineSubmissionByOwner() throws Exception {
ApproveDTO approveDTO = new ApproveDTO(SUBMISSION_ID, false, null, "comment");
prepareAnalysisFile(STUDY_ID, ANALYSIS_ID);
prepareSubmissionGroupFile(STUDY_ID, ANALYSIS_ID, SUBMISSION_GROUP_ID);
mvc.perform(post("/api/v1/analysis-management/submissions/{submissionId}/approve", 1).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(approveDTO))).andExpect(NO_ERROR_CODE);
}
use of com.github.springtestdbunit.annotation.ExpectedDatabases in project ArachneCentralAPI by OHDSI.
the class AnalysisSubmissionControllerTests method testApproveSubmissionByOwner.
@Test
@WithUserDetails(DATA_NODE_ONWER)
@DatabaseSetups({ @DatabaseSetup("/data/analysis/submission/submission-pending.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/analysis/submission/result/submission-datasource2-approved.xml", assertionMode = NON_STRICT) })
public void testApproveSubmissionByOwner() throws Exception {
ApproveDTO approveDTO = new ApproveDTO(SUBMISSION_ID, true, null, "string");
prepareAnalysisFile(STUDY_ID, ANALYSIS_ID);
prepareSubmissionGroupFile(STUDY_ID, ANALYSIS_ID, SUBMISSION_GROUP_ID);
mvc.perform(post("/api/v1/analysis-management/submissions/{submissionId}/approve", 1).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(approveDTO))).andExpect(NO_ERROR_CODE);
}
use of com.github.springtestdbunit.annotation.ExpectedDatabases in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateContributorRoleToContributor.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetups({ @DatabaseSetup("/data/study/study-participant-with-2-leaders-before-updating.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-participant-with-contributor-and-leader.xml", assertionMode = NON_STRICT) })
public void testUpdateContributorRoleToContributor() throws Exception {
UpdateParticipantDTO participantDTO = new UpdateParticipantDTO();
participantDTO.setRole(CONTRIBUTOR.name());
mvc.perform(put("/api/v1/study-management/studies/" + STUDY_ID + "/participants/" + UserIdUtils.idToUuid(ADMIN_ID)).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(participantDTO))).andExpect(NO_ERROR_CODE).andReturn();
}
use of com.github.springtestdbunit.annotation.ExpectedDatabases in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUploadFile.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/study/study-after-updating-description.xml")
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-after-updating-description.xml", assertionMode = NON_STRICT), @ExpectedDatabase(value = "/data/study/studies-files.xml", assertionMode = NON_STRICT) })
public void testUploadFile() throws Exception {
String path = this.getClass().getResource("/test.jpg").getPath();
FileInputStream fileInputStream = new FileInputStream(path);
MockMultipartFile multipartFile = new MockMultipartFile("file", "test.jpg", "image/jpeg", fileInputStream);
mvc.perform(fileUpload("/api/v1/study-management/studies/" + STUDY_ID + "/upload").file(multipartFile).param("label", "labelUploadedFile").param("file", path).contentType(MULTIPART_FORM_DATA)).andExpect(NO_ERROR_CODE);
}
Aggregations