use of com.epam.ta.reportportal.ws.model.item.UpdateTestItemRQ in project service-api by reportportal.
the class TestItemControllerTest method changeStatusFromInterruptedToFailed.
@Sql("/db/test-item/item-change-status-from-interrupted.sql")
@Test
void changeStatusFromInterruptedToFailed() 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