Search in sources :

Example 1 with UpdateOneIssueSubTypeRQ

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());
}
Also used : UpdateOneIssueSubTypeRQ(com.epam.ta.reportportal.ws.model.project.config.UpdateOneIssueSubTypeRQ) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) UpdateIssueSubTypeRQ(com.epam.ta.reportportal.ws.model.project.config.UpdateIssueSubTypeRQ) ReportPortalUser(com.epam.ta.reportportal.commons.ReportPortalUser) Test(org.junit.jupiter.api.Test)

Example 2 with UpdateOneIssueSubTypeRQ

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());
}
Also used : Project(com.epam.ta.reportportal.entity.project.Project) UpdateOneIssueSubTypeRQ(com.epam.ta.reportportal.ws.model.project.config.UpdateOneIssueSubTypeRQ) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) UpdateIssueSubTypeRQ(com.epam.ta.reportportal.ws.model.project.config.UpdateIssueSubTypeRQ) ReportPortalUser(com.epam.ta.reportportal.commons.ReportPortalUser) Test(org.junit.jupiter.api.Test)

Example 3 with UpdateOneIssueSubTypeRQ

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());
}
Also used : Project(com.epam.ta.reportportal.entity.project.Project) UpdateOneIssueSubTypeRQ(com.epam.ta.reportportal.ws.model.project.config.UpdateOneIssueSubTypeRQ) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) UpdateIssueSubTypeRQ(com.epam.ta.reportportal.ws.model.project.config.UpdateIssueSubTypeRQ) ReportPortalUser(com.epam.ta.reportportal.commons.ReportPortalUser) Test(org.junit.jupiter.api.Test)

Example 4 with UpdateOneIssueSubTypeRQ

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());
}
Also used : UpdateOneIssueSubTypeRQ(com.epam.ta.reportportal.ws.model.project.config.UpdateOneIssueSubTypeRQ) UpdateIssueSubTypeRQ(com.epam.ta.reportportal.ws.model.project.config.UpdateIssueSubTypeRQ) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest) Test(org.junit.jupiter.api.Test)

Aggregations

UpdateIssueSubTypeRQ (com.epam.ta.reportportal.ws.model.project.config.UpdateIssueSubTypeRQ)4 UpdateOneIssueSubTypeRQ (com.epam.ta.reportportal.ws.model.project.config.UpdateOneIssueSubTypeRQ)4 Test (org.junit.jupiter.api.Test)4 ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)3 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)3 Project (com.epam.ta.reportportal.entity.project.Project)2 BaseMvcTest (com.epam.ta.reportportal.ws.BaseMvcTest)1