use of com.epam.ta.reportportal.ws.model.project.config.UpdateOneIssueSubTypeRQ in project service-api by reportportal.
the class UpdateProjectSettingsHandlerImplTest method updateSubtypeOnNotExistProject.
@Test
void updateSubtypeOnNotExistProject() {
long projectId = 1L;
ReportPortalUser user = getRpUser("user", UserRole.USER, ProjectRole.PROJECT_MANAGER, projectId);
UpdateIssueSubTypeRQ updateIssueSubTypeRQ = new UpdateIssueSubTypeRQ();
updateIssueSubTypeRQ.setIds(Collections.singletonList(new UpdateOneIssueSubTypeRQ()));
when(projectRepository.findByName(TEST_PROJECT_NAME)).thenReturn(Optional.empty());
ReportPortalException exception = assertThrows(ReportPortalException.class, () -> handler.updateProjectIssueSubType(TEST_PROJECT_NAME, user, updateIssueSubTypeRQ));
assertEquals("Project 'test_project' not found. Did you use correct project name?", exception.getMessage());
}
use of com.epam.ta.reportportal.ws.model.project.config.UpdateOneIssueSubTypeRQ in project service-api by reportportal.
the class UpdateProjectSettingsHandlerImplTest method updateNotExistSubtype.
@Test
void updateNotExistSubtype() {
long projectId = 1L;
ReportPortalUser user = getRpUser("user", UserRole.USER, ProjectRole.PROJECT_MANAGER, projectId);
UpdateIssueSubTypeRQ updateIssueSubTypeRQ = new UpdateIssueSubTypeRQ();
UpdateOneIssueSubTypeRQ oneIssueSubTypeRQ = new UpdateOneIssueSubTypeRQ();
oneIssueSubTypeRQ.setTypeRef("product_bug");
oneIssueSubTypeRQ.setLocator("locator");
updateIssueSubTypeRQ.setIds(Collections.singletonList(oneIssueSubTypeRQ));
when(projectRepository.findByName(TEST_PROJECT_NAME)).thenReturn(Optional.of(new Project()));
ReportPortalException exception = assertThrows(ReportPortalException.class, () -> handler.updateProjectIssueSubType(TEST_PROJECT_NAME, user, updateIssueSubTypeRQ));
assertEquals("Issue Type 'locator' not found.", exception.getMessage());
}
use of com.epam.ta.reportportal.ws.model.project.config.UpdateOneIssueSubTypeRQ in project service-api by reportportal.
the class UpdateProjectSettingsHandlerImplTest method updateSubtypeWithIncorrectGroup.
@Test
void updateSubtypeWithIncorrectGroup() {
long projectId = 1L;
ReportPortalUser user = getRpUser("user", UserRole.USER, ProjectRole.PROJECT_MANAGER, projectId);
UpdateIssueSubTypeRQ updateIssueSubTypeRQ = new UpdateIssueSubTypeRQ();
UpdateOneIssueSubTypeRQ oneIssueSubTypeRQ = new UpdateOneIssueSubTypeRQ();
oneIssueSubTypeRQ.setTypeRef("wrongType");
updateIssueSubTypeRQ.setIds(Collections.singletonList(oneIssueSubTypeRQ));
when(projectRepository.findByName(TEST_PROJECT_NAME)).thenReturn(Optional.of(new Project()));
ReportPortalException exception = assertThrows(ReportPortalException.class, () -> handler.updateProjectIssueSubType(TEST_PROJECT_NAME, user, updateIssueSubTypeRQ));
assertEquals("Issue Type 'wrongType' not found.", exception.getMessage());
}
use of com.epam.ta.reportportal.ws.model.project.config.UpdateOneIssueSubTypeRQ in project service-api by reportportal.
the class ProjectSettingsControllerTest method updateSubType.
@Test
void updateSubType() throws Exception {
UpdateIssueSubTypeRQ request = new UpdateIssueSubTypeRQ();
final UpdateOneIssueSubTypeRQ updateOneIssueSubTypeRQ = new UpdateOneIssueSubTypeRQ();
updateOneIssueSubTypeRQ.setColor("#000000");
updateOneIssueSubTypeRQ.setLocator("custom_ti");
updateOneIssueSubTypeRQ.setLongName("updated");
updateOneIssueSubTypeRQ.setShortName("upd");
updateOneIssueSubTypeRQ.setTypeRef("TO_INVESTIGATE");
request.setIds(Collections.singletonList(updateOneIssueSubTypeRQ));
mockMvc.perform(put(DEFAULT_PROJECT_BASE_URL + "/settings/sub-type").with(token(oAuthHelper.getDefaultToken())).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().isOk());
}
Aggregations