use of org.sonarqube.ws.Qualitygates.ListWsResponse in project sonarqube by SonarSource.
the class ListActionTest method actions_without_quality_gate_administer_permission.
@Test
public void actions_without_quality_gate_administer_permission() {
userSession.logIn("john").addPermission(ADMINISTER_QUALITY_PROFILES);
QualityGateDto defaultQualityGate = db.qualityGates().insertQualityGate(qg -> qg.setName("Sonar way").setBuiltIn(true));
QualityGateDto otherQualityGate = db.qualityGates().insertQualityGate(qg -> qg.setName("Sonar way - Without Coverage").setBuiltIn(false));
db.qualityGates().setDefaultQualityGate(defaultQualityGate);
ListWsResponse response = ws.newRequest().executeProtobuf(ListWsResponse.class);
assertThat(response.getActions()).extracting(ListWsResponse.RootActions::getCreate).isEqualTo(false);
assertThat(response.getQualitygatesList()).extracting(QualityGate::getName, qg -> qg.getActions().getRename(), qg -> qg.getActions().getDelete(), qg -> qg.getActions().getManageConditions(), qp -> qp.getActions().getCopy(), qp -> qp.getActions().getSetAsDefault(), qp -> qp.getActions().getAssociateProjects(), qp -> qp.getActions().getDelegate()).containsExactlyInAnyOrder(tuple(defaultQualityGate.getName(), false, false, false, false, false, false, false), tuple(otherQualityGate.getName(), false, false, false, false, false, false, false));
}
Aggregations