use of com.github.springtestdbunit.annotation.ExpectedDatabase in project ArachneCentralAPI by OHDSI.
the class SkillControllerTests method testGetSkill.
@Test
@DatabaseSetup("/data/skill/skill-after-updating.xml")
@ExpectedDatabase(value = "/data/skill/skill-after-updating.xml", assertionMode = NON_STRICT)
public void testGetSkill() throws Exception {
MvcResult mvcResult = mvc.perform(get("/api/v1/user-management/skills/" + SKILL_ID)).andExpect(OK_STATUS).andExpect(NO_ERROR_CODE).andReturn();
JSONAssert.assertEquals(UPDATED_SKILL_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
use of com.github.springtestdbunit.annotation.ExpectedDatabase in project ArachneCentralAPI by OHDSI.
the class SkillControllerTests method testCreateSkill.
@Test
@DatabaseSetup("/data/skill/empty-skill.xml")
@ExpectedDatabase(value = "/data/skill/added-skill.xml", assertionMode = NON_STRICT)
public void testCreateSkill() throws Exception {
SkillDTO skillDTO = new SkillDTO();
skillDTO.setName(SKILL_NAME);
MvcResult mvcResult = mvc.perform(post("/api/v1/user-management/skills/").contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(skillDTO))).andExpect(jsonPath("$.result.id").isNotEmpty()).andExpect(OK_STATUS).andExpect(NO_ERROR_CODE).andReturn();
JSONAssert.assertEquals(SKILL_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
use of com.github.springtestdbunit.annotation.ExpectedDatabase in project ArachneCentralAPI by OHDSI.
the class StudyTypeControllerTests method testGetStudyType.
@Test
@DatabaseSetup("/data/study/type/study-type-after-updating.xml")
@ExpectedDatabase(value = "/data/study/type/study-type-after-updating.xml", assertionMode = NON_STRICT)
public void testGetStudyType() throws Exception {
MvcResult mvcResult = mvc.perform(get("/api/v1/study-management/study-types/" + ID)).andExpect(OK_STATUS).andReturn();
JSONAssert.assertEquals(UPDATED_STUDY_TYPE_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
use of com.github.springtestdbunit.annotation.ExpectedDatabase in project ArachneCentralAPI by OHDSI.
the class StudyTypeControllerTests method testCreateStudyType.
@Test
@DatabaseSetup("/data/study/type/empty-study-type.xml")
@ExpectedDatabase(value = "/data/study/type/added-study-type.xml", assertionMode = NON_STRICT)
public void testCreateStudyType() throws Exception {
CreateStudyTypeDTO dto = new CreateStudyTypeDTO();
dto.setName(NAME);
MvcResult mvcResult = mvc.perform(post("/api/v1/admin/study-types").contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(dto))).andExpect(jsonPath("$.result.id").isNotEmpty()).andExpect(OK_STATUS).andReturn();
JSONAssert.assertEquals(STUDY_TYPE_JSON_OBJECT, getResultJSONObject(mvcResult), false);
}
use of com.github.springtestdbunit.annotation.ExpectedDatabase in project ArachneCentralAPI by OHDSI.
the class UserControllerTests method testUploadAvatar.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/user/admin-user.xml")
@ExpectedDatabase(value = "/data/user/admin-user.xml", assertionMode = NON_STRICT)
public void testUploadAvatar() throws Exception {
FileInputStream fileInputStream = new FileInputStream(this.getClass().getResource("/test.jpg").getPath());
MockMultipartFile multipartFile = new MockMultipartFile("file", "test.jpg", "image/jpeg", fileInputStream);
this.mvc.perform(fileUpload("/api/v1/user-management/users/avatar").file(multipartFile).contentType(MULTIPART_FORM_DATA)).andExpect(TRUE_RESULT).andExpect(NO_ERROR_CODE).andExpect(OK_STATUS);
}
Aggregations