use of org.sonarqube.ws.Qualitygates.ListWsResponse in project sonarqube by SonarSource.
the class ListActionTest method actions_with_quality_gate_delegate_permission.
@Test
public void actions_with_quality_gate_delegate_permission() {
QualityGateDto defaultQualityGate = db.qualityGates().insertQualityGate(qg -> qg.setName("Sonar way"));
QualityGateDto otherQualityGate = db.qualityGates().insertQualityGate(qg -> qg.setName("Sonar way - Without Coverage"));
UserDto user = db.users().insertUser();
db.qualityGates().addUserPermission(defaultQualityGate, user);
db.qualityGates().addUserPermission(otherQualityGate, user);
userSession.logIn(user);
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, true, false, false, false, true), tuple(otherQualityGate.getName(), false, false, true, false, false, false, true));
}
use of org.sonarqube.ws.Qualitygates.ListWsResponse in project sonarqube by SonarSource.
the class ListActionTest method list_quality_gates.
@Test
public void list_quality_gates() {
QualityGateDto defaultQualityGate = db.qualityGates().insertQualityGate();
QualityGateDto otherQualityGate = db.qualityGates().insertQualityGate();
db.qualityGates().setDefaultQualityGate(defaultQualityGate);
ListWsResponse response = ws.newRequest().executeProtobuf(ListWsResponse.class);
assertThat(response.getQualitygatesList()).extracting(QualityGate::getId, QualityGate::getName, QualityGate::getIsDefault).containsExactlyInAnyOrder(tuple(defaultQualityGate.getUuid(), defaultQualityGate.getName(), true), tuple(otherQualityGate.getUuid(), otherQualityGate.getName(), false));
}
use of org.sonarqube.ws.Qualitygates.ListWsResponse in project sonarqube by SonarSource.
the class ListActionTest method actions_with_quality_gate_administer_permission.
@Test
public void actions_with_quality_gate_administer_permission() {
userSession.logIn("john").addPermission(ADMINISTER_QUALITY_GATES);
QualityGateDto defaultQualityGate = db.qualityGates().insertQualityGate(qg -> qg.setName("Default").setBuiltIn(false));
QualityGateDto builtInQualityGate = 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(true);
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(), true, false, true, true, false, false, true), tuple(builtInQualityGate.getName(), false, false, false, true, true, true, false), tuple(otherQualityGate.getName(), true, true, true, true, true, true, true));
}
use of org.sonarqube.ws.Qualitygates.ListWsResponse in project sonarqube by SonarSource.
the class ListActionTest method test_deprecated_default_field.
@Test
public void test_deprecated_default_field() {
QualityGateDto defaultQualityGate = db.qualityGates().insertQualityGate();
db.qualityGates().setDefaultQualityGate(defaultQualityGate);
ListWsResponse response = ws.newRequest().executeProtobuf(ListWsResponse.class);
assertThat(response.getDefault()).isEqualTo(defaultQualityGate.getUuid());
}
use of org.sonarqube.ws.Qualitygates.ListWsResponse in project sonarqube by SonarSource.
the class ListActionTest method test_built_in_flag.
@Test
public void test_built_in_flag() {
QualityGateDto qualityGate1 = db.qualityGates().insertQualityGate(qualityGate -> qualityGate.setBuiltIn(true));
QualityGateDto qualityGate2 = db.qualityGates().insertQualityGate(qualityGate -> qualityGate.setBuiltIn(false));
db.qualityGates().setDefaultQualityGate(qualityGate1);
ListWsResponse response = ws.newRequest().executeProtobuf(ListWsResponse.class);
assertThat(response.getQualitygatesList()).extracting(QualityGate::getId, QualityGate::getIsBuiltIn).containsExactlyInAnyOrder(tuple(qualityGate1.getUuid(), true), tuple(qualityGate2.getUuid(), false));
}
Aggregations