use of org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse in project sonarqube by SonarSource.
the class SearchGroupsActionTest method qp_administers_can_search_groups.
@Test
public void qp_administers_can_search_groups() {
QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(XOO));
GroupDto group = db.users().insertGroup();
db.qualityProfiles().addGroupPermission(profile, group);
userSession.logIn().addPermission(GlobalPermission.ADMINISTER_QUALITY_PROFILES);
SearchGroupsResponse response = ws.newRequest().setParam(PARAM_QUALITY_PROFILE, profile.getName()).setParam(PARAM_LANGUAGE, XOO).setParam(SELECTED, "all").executeProtobuf(SearchGroupsResponse.class);
assertThat(response.getGroupsList()).extracting(SearchGroupsResponse.Group::getName).containsExactlyInAnyOrder(group.getName());
}
use of org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse in project sonarqube by SonarSource.
the class SearchGroupsActionTest method search_by_name.
@Test
public void search_by_name() {
QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(XOO));
GroupDto group1 = db.users().insertGroup("sonar-users-project");
GroupDto group2 = db.users().insertGroup("sonar-users-qprofile");
GroupDto group3 = db.users().insertGroup("sonar-admin");
db.qualityProfiles().addGroupPermission(profile, group1);
db.qualityProfiles().addGroupPermission(profile, group2);
db.qualityProfiles().addGroupPermission(profile, group3);
userSession.logIn().addPermission(ADMINISTER_QUALITY_PROFILES);
SearchGroupsResponse response = ws.newRequest().setParam(PARAM_QUALITY_PROFILE, profile.getName()).setParam(PARAM_LANGUAGE, XOO).setParam(TEXT_QUERY, "UsErS").setParam(SELECTED, "all").executeProtobuf(SearchGroupsResponse.class);
assertThat(response.getGroupsList()).extracting(SearchGroupsResponse.Group::getName).containsExactlyInAnyOrder(group1.getName(), group2.getName());
}
use of org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse in project sonarqube by SonarSource.
the class SearchGroupsActionTest method search_selected_groups.
@Test
public void search_selected_groups() {
QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(XOO));
GroupDto group1 = db.users().insertGroup();
GroupDto group2 = db.users().insertGroup();
db.qualityProfiles().addGroupPermission(profile, group1);
userSession.logIn().addPermission(ADMINISTER_QUALITY_PROFILES);
SearchGroupsResponse response = ws.newRequest().setParam(PARAM_QUALITY_PROFILE, profile.getName()).setParam(PARAM_LANGUAGE, XOO).setParam(SELECTED, "selected").executeProtobuf(SearchGroupsResponse.class);
assertThat(response.getGroupsList()).extracting(SearchGroupsResponse.Group::getName, SearchGroupsResponse.Group::getDescription, SearchGroupsResponse.Group::getSelected).containsExactlyInAnyOrder(tuple(group1.getName(), group1.getDescription(), true));
}
Aggregations