Search in sources :

Example 6 with SearchWsResponse

use of org.sonarqube.ws.WsMeasures.SearchWsResponse in project sonarqube by SonarSource.

the class SearchActionTest method do_not_verify_permissions_if_user_is_root.

@Test
public void do_not_verify_permissions_if_user_is_root() {
    MetricDto metricDto = insertComplexityMetric();
    ComponentDto project1 = newProjectDto(db.getDefaultOrganization());
    SnapshotDto projectSnapshot1 = db.components().insertProjectAndSnapshot(project1);
    dbClient.measureDao().insert(dbSession, newMeasureDto(metricDto, project1, projectSnapshot1).setValue(15.5d));
    db.commit();
    userSession.setNonRoot();
    SearchWsResponse result = call(asList(project1.key()), singletonList("complexity"));
    assertThat(result.getMeasuresCount()).isEqualTo(0);
    userSession.setRoot();
    result = call(asList(project1.key()), singletonList("complexity"));
    assertThat(result.getMeasuresCount()).isEqualTo(1);
}
Also used : MetricTesting.newMetricDto(org.sonar.db.metric.MetricTesting.newMetricDto) MetricDto(org.sonar.db.metric.MetricDto) SnapshotDto(org.sonar.db.component.SnapshotDto) ComponentDto(org.sonar.db.component.ComponentDto) SearchWsResponse(org.sonarqube.ws.WsMeasures.SearchWsResponse) Test(org.junit.Test)

Aggregations

SearchWsResponse (org.sonarqube.ws.WsMeasures.SearchWsResponse)6 Test (org.junit.Test)5 ComponentDto (org.sonar.db.component.ComponentDto)5 SnapshotDto (org.sonar.db.component.SnapshotDto)5 MetricDto (org.sonar.db.metric.MetricDto)5 MetricTesting.newMetricDto (org.sonar.db.metric.MetricTesting.newMetricDto)5 Measure (org.sonarqube.ws.WsMeasures.Measure)2 DbSession (org.sonar.db.DbSession)1 OrganizationDto (org.sonar.db.organization.OrganizationDto)1 WsMeasures (org.sonarqube.ws.WsMeasures)1