use of org.sonar.db.qualitygate.QualityGateDto in project sonarqube by SonarSource.
the class GetByProjectActionTest method default_quality_gate.
@Test
public void default_quality_gate() {
ComponentDto project = componentDb.insertComponent(newProjectDto(db.organizations().insert()));
QualityGateDto dbQualityGate = insertQualityGate("Sonar way");
setDefaultQualityGate(dbQualityGate.getId());
logInAsProjectUser(project);
GetByProjectWsResponse result = callByUuid(project.uuid());
WsQualityGates.QualityGate qualityGate = result.getQualityGate();
assertThat(Long.valueOf(qualityGate.getId())).isEqualTo(dbQualityGate.getId());
assertThat(qualityGate.getName()).isEqualTo(dbQualityGate.getName());
assertThat(qualityGate.getDefault()).isTrue();
}
use of org.sonar.db.qualitygate.QualityGateDto in project sonarqube by SonarSource.
the class GetByProjectActionTest method get_by_project_key.
@Test
public void get_by_project_key() {
ComponentDto project = componentDb.insertComponent(newProjectDto(db.organizations().insert()));
QualityGateDto dbQualityGate = insertQualityGate("My team QG");
associateProjectToQualityGate(project.getId(), dbQualityGate.getId());
logInAsProjectUser(project);
GetByProjectWsResponse result = callByKey(project.key());
assertThat(result.getQualityGate().getName()).isEqualTo(dbQualityGate.getName());
}
use of org.sonar.db.qualitygate.QualityGateDto in project sonarqube by SonarSource.
the class GetByProjectActionTest method project_quality_gate_over_default.
@Test
public void project_quality_gate_over_default() {
ComponentDto project = componentDb.insertComponent(newProjectDto(db.getDefaultOrganization()));
QualityGateDto defaultDbQualityGate = insertQualityGate("Sonar way");
QualityGateDto dbQualityGate = insertQualityGate("My team QG");
setDefaultQualityGate(defaultDbQualityGate.getId());
associateProjectToQualityGate(project.getId(), dbQualityGate.getId());
logInAsProjectUser(project);
GetByProjectWsResponse result = callByUuid(project.uuid());
WsQualityGates.QualityGate qualityGate = result.getQualityGate();
assertThat(qualityGate.getName()).isEqualTo(dbQualityGate.getName());
assertThat(qualityGate.getDefault()).isFalse();
}
use of org.sonar.db.qualitygate.QualityGateDto in project sonarqube by SonarSource.
the class GetByProjectActionTest method get_with_project_user_permission.
@Test
public void get_with_project_user_permission() {
ComponentDto project = componentDb.insertProject();
userSession.logIn().addProjectUuidPermissions(UserRole.USER, project.uuid());
QualityGateDto dbQualityGate = insertQualityGate("Sonar way");
setDefaultQualityGate(dbQualityGate.getId());
GetByProjectWsResponse result = callByUuid(project.uuid());
assertThat(result.getQualityGate().getName()).isEqualTo(dbQualityGate.getName());
}
use of org.sonar.db.qualitygate.QualityGateDto in project sonarqube by SonarSource.
the class GetByProjectActionTest method json_example.
@Test
public void json_example() {
OrganizationDto organizationDto = db.organizations().insert();
ComponentDto project = componentDb.insertComponent(newProjectDto(organizationDto));
QualityGateDto qualityGate = insertQualityGate("My team QG");
associateProjectToQualityGate(project.getId(), qualityGate.getId());
logInAsProjectUser(project);
String result = ws.newRequest().setParam(PARAM_PROJECT_ID, project.uuid()).execute().getInput();
assertJson(result).ignoreFields("id").isSimilarTo(getClass().getResource("get_by_project-example.json"));
}
Aggregations