use of com.epam.ta.reportportal.ws.model.item.UpdateTestItemRQ in project service-api by reportportal.
the class TestItemControllerTest method changeStatusFromFailedToSkipped.
@Sql("/db/test-item/item-change-status-from-failed.sql")
@Test
void changeStatusFromFailedToSkipped() 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.AUTOMATION_BUG, 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());
}
use of com.epam.ta.reportportal.ws.model.item.UpdateTestItemRQ in project service-api by reportportal.
the class TestItemControllerTest method changeStatusFromInterruptedToPassed.
@Sql("/db/test-item/item-change-status-from-interrupted.sql")
@Test
void changeStatusFromInterruptedToPassed() 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 changeStatusNegative.
@Test
void changeStatusNegative() throws Exception {
UpdateTestItemRQ request = new UpdateTestItemRQ();
request.setStatus("failed");
mockMvc.perform(put(SUPERADMIN_PROJECT_BASE_URL + "/item/5/update").with(token(oAuthHelper.getSuperadminToken())).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().is(400));
}
use of com.epam.ta.reportportal.ws.model.item.UpdateTestItemRQ in project service-api by reportportal.
the class TestItemControllerTest method changeStatusFromPassedToFailed.
@Sql("/db/test-item/item-change-status-from-passed.sql")
@Test
void changeStatusFromPassedToFailed() 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(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 changeStatusFromFailedToPassed.
@Sql("/db/test-item/item-change-status-from-failed.sql")
@Test
void changeStatusFromFailedToPassed() 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());
}
Aggregations