use of com.epam.ta.reportportal.ws.model.item.UpdateTestItemRQ in project service-api by reportportal.
the class TestItemControllerTest method updateTestItemPositive.
@Test
void updateTestItemPositive() throws Exception {
UpdateTestItemRQ rq = new UpdateTestItemRQ();
rq.setDescription("updated");
rq.setAttributes(Sets.newHashSet(new ItemAttributeResource("test", "test")));
mockMvc.perform(put(DEFAULT_PROJECT_BASE_URL + "/item/1/update").with(token(oAuthHelper.getDefaultToken())).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(rq))).andExpect(status().isOk());
}
use of com.epam.ta.reportportal.ws.model.item.UpdateTestItemRQ in project service-api by reportportal.
the class TestItemControllerTest method changeStatusFromPassedToSkippedWithoutIssue.
@Sql("/db/test-item/item-change-status-from-passed.sql")
@Test
void changeStatusFromPassedToSkippedWithoutIssue() throws Exception {
UpdateTestItemRQ request = new UpdateTestItemRQ();
request.setStatus("skipped");
mockMvc.perform(put(SUPERADMIN_PROJECT_BASE_URL + "/item/9/update").with(token(oAuthHelper.getSuperadminToken())).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().isOk());
Optional<TestItem> updatedItem = testItemRepository.findById(9L);
assertTrue(updatedItem.isPresent());
assertEquals(StatusEnum.SKIPPED, updatedItem.get().getItemResults().getStatus());
assertNull(updatedItem.get().getItemResults().getIssue());
assertEquals(StatusEnum.FAILED, testItemRepository.findById(updatedItem.get().getParentId()).get().getItemResults().getStatus());
Launch launch = launchRepository.findById(updatedItem.get().getLaunchId()).get();
assertEquals(StatusEnum.FAILED, launch.getStatus());
verify(messageBus, times(2)).publishActivity(ArgumentMatchers.any());
}
use of com.epam.ta.reportportal.ws.model.item.UpdateTestItemRQ in project service-api by reportportal.
the class TestItemControllerTest method changeStatusFromPassedToSkipped.
@Sql("/db/test-item/item-change-status-from-passed.sql")
@Test
void changeStatusFromPassedToSkipped() throws Exception {
UpdateTestItemRQ request = new UpdateTestItemRQ();
request.setStatus("skipped");
mockMvc.perform(put(SUPERADMIN_PROJECT_BASE_URL + "/item/6/update").with(token(oAuthHelper.getSuperadminToken())).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().isOk());
Optional<TestItem> updatedItem = testItemRepository.findById(6L);
assertTrue(updatedItem.isPresent());
assertEquals(StatusEnum.SKIPPED, updatedItem.get().getItemResults().getStatus());
assertEquals(TestItemIssueGroup.TO_INVESTIGATE, updatedItem.get().getItemResults().getIssue().getIssueType().getIssueGroup().getTestItemIssueGroup());
assertEquals(StatusEnum.FAILED, testItemRepository.findById(updatedItem.get().getParentId()).get().getItemResults().getStatus());
Launch launch = launchRepository.findById(updatedItem.get().getLaunchId()).get();
assertEquals(StatusEnum.FAILED, launch.getStatus());
verify(messageBus, times(2)).publishActivity(ArgumentMatchers.any());
}
use of com.epam.ta.reportportal.ws.model.item.UpdateTestItemRQ in project service-api by reportportal.
the class TestItemControllerTest method changeStatusFromSkippedToPassed.
@Sql("/db/test-item/item-change-status-from-skipped.sql")
@Test
void changeStatusFromSkippedToPassed() throws Exception {
UpdateTestItemRQ request = new UpdateTestItemRQ();
request.setStatus("passed");
mockMvc.perform(put(SUPERADMIN_PROJECT_BASE_URL + "/item/6/update").with(token(oAuthHelper.getSuperadminToken())).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().isOk());
Optional<TestItem> updatedItem = testItemRepository.findById(6L);
assertTrue(updatedItem.isPresent());
assertEquals(StatusEnum.PASSED, updatedItem.get().getItemResults().getStatus());
assertNull(updatedItem.get().getItemResults().getIssue());
assertEquals(StatusEnum.PASSED, testItemRepository.findById(updatedItem.get().getParentId()).get().getItemResults().getStatus());
Launch launch = launchRepository.findById(updatedItem.get().getLaunchId()).get();
assertEquals(StatusEnum.PASSED, launch.getStatus());
verify(messageBus, times(2)).publishActivity(ArgumentMatchers.any());
}
use of com.epam.ta.reportportal.ws.model.item.UpdateTestItemRQ in project service-api by reportportal.
the class TestItemControllerTest method changeStatusFromSkippedToFailed.
@Sql("/db/test-item/item-change-status-from-skipped.sql")
@Test
void changeStatusFromSkippedToFailed() throws Exception {
UpdateTestItemRQ request = new UpdateTestItemRQ();
request.setStatus("failed");
mockMvc.perform(put(SUPERADMIN_PROJECT_BASE_URL + "/item/6/update").with(token(oAuthHelper.getSuperadminToken())).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().isOk());
Optional<TestItem> updatedItem = testItemRepository.findById(6L);
assertTrue(updatedItem.isPresent());
assertEquals(StatusEnum.FAILED, updatedItem.get().getItemResults().getStatus());
assertEquals(TestItemIssueGroup.TO_INVESTIGATE, updatedItem.get().getItemResults().getIssue().getIssueType().getIssueGroup().getTestItemIssueGroup());
assertEquals(StatusEnum.FAILED, testItemRepository.findById(updatedItem.get().getParentId()).get().getItemResults().getStatus());
Launch launch = launchRepository.findById(updatedItem.get().getLaunchId()).get();
assertEquals(StatusEnum.FAILED, launch.getStatus());
verify(messageBus, times(1)).publishActivity(ArgumentMatchers.any());
}
Aggregations