use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class ActivityActionTest method throws_IAE_if_page_is_higher_than_available.
@Test
public void throws_IAE_if_page_is_higher_than_available() {
logInAsSystemAdministrator();
ComponentDto project1 = db.components().insertPrivateProject();
insertActivity("T1", project1, SUCCESS);
insertActivity("T2", project1, SUCCESS);
insertActivity("T3", project1, SUCCESS);
TestRequest request = ws.newRequest().setParam(Param.PAGE, Integer.toString(2)).setParam(Param.PAGE_SIZE, Integer.toString(3)).setParam(PARAM_STATUS, "SUCCESS,FAILED,CANCELED,IN_PROGRESS,PENDING");
assertThatThrownBy(() -> call(request)).isInstanceOf(IllegalArgumentException.class).hasMessage("Can return only the first 3 results. 4th result asked.");
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class ActivityActionTest method search_by_task_id_returns_403_if_project_admin_but_not_root.
@Test
public void search_by_task_id_returns_403_if_project_admin_but_not_root() {
// WS api/ce/task must be used in order to search by task id.
// Here it's a convenient feature of search by text query, which
// is reserved to roots
ComponentDto view = db.components().insertPrivatePortfolio();
insertActivity("T1", view, SUCCESS);
userSession.logIn().addProjectPermission(UserRole.ADMIN, view);
TestRequest request = ws.newRequest().setParam(TEXT_QUERY, "T1");
assertThatThrownBy(() -> call(request)).isInstanceOf(ForbiddenException.class).hasMessage("Insufficient privileges");
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class TokenRenewActionTest method missing_project_admin_permission_should_fail.
@Test
public void missing_project_admin_permission_should_fail() {
ComponentDto project = db.components().insertPrivateProject();
TestRequest request = ws.newRequest().setParam("project", project.getKey());
Assertions.assertThatThrownBy(request::execute).hasMessage("Insufficient privileges").isInstanceOf(ForbiddenException.class);
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class TokenActionTest method missing_project_parameter_should_fail.
@Test
public void missing_project_parameter_should_fail() {
TestRequest request = ws.newRequest();
Assertions.assertThatThrownBy(request::execute).hasMessage("The 'project' parameter is missing").isInstanceOf(IllegalArgumentException.class);
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class TokenActionTest method missing_project_permission_should_fail.
@Test
public void missing_project_permission_should_fail() {
ComponentDto project = db.components().insertPrivateProject();
TestRequest request = ws.newRequest().setParam("project", project.getKey());
Assertions.assertThatThrownBy(request::execute).hasMessage("Insufficient privileges").isInstanceOf(ForbiddenException.class);
}
Aggregations