use of org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse in project sonarqube by SonarSource.
the class SearchGroupsActionTest method group_without_description.
@Test
public void group_without_description() {
QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(XOO));
GroupDto group = db.users().insertGroup(newGroupDto().setDescription(null));
db.qualityProfiles().addGroupPermission(profile, group);
userSession.logIn().addPermission(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, SearchGroupsResponse.Group::hasDescription).containsExactlyInAnyOrder(tuple(group.getName(), false));
}
use of org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse in project sonarqube by SonarSource.
the class SearchGroupsActionTest method qp_editors_can_search_groups.
@Test
public void qp_editors_can_search_groups() {
QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(XOO));
GroupDto group = db.users().insertGroup();
db.qualityProfiles().addGroupPermission(profile, group);
UserDto userAllowedToEditProfile = db.users().insertUser();
db.qualityProfiles().addUserPermission(profile, userAllowedToEditProfile);
userSession.logIn(userAllowedToEditProfile);
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_all_groups.
@Test
public void search_all_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, "all").executeProtobuf(SearchGroupsResponse.class);
assertThat(response.getGroupsList()).extracting(SearchGroupsResponse.Group::getName, SearchGroupsResponse.Group::getDescription, SearchGroupsResponse.Group::getSelected).containsExactlyInAnyOrder(tuple(group1.getName(), group1.getDescription(), true), tuple(group2.getName(), group2.getDescription(), false));
}
use of org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse in project sonarqube by SonarSource.
the class SearchGroupsActionTest method search_deselected_groups.
@Test
public void search_deselected_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, "deselected").executeProtobuf(SearchGroupsResponse.class);
assertThat(response.getGroupsList()).extracting(SearchGroupsResponse.Group::getName, SearchGroupsResponse.Group::getDescription, SearchGroupsResponse.Group::getSelected).containsExactlyInAnyOrder(tuple(group2.getName(), group2.getDescription(), false));
}
use of org.sonarqube.ws.Qualityprofiles.SearchGroupsResponse in project sonarqube by SonarSource.
the class SearchGroupsActionTest method uses_global_permission.
@Test
public void uses_global_permission() {
QProfileDto profile = db.qualityProfiles().insert(p -> p.setLanguage(XOO));
GroupDto group = db.users().insertGroup();
db.qualityProfiles().addGroupPermission(profile, group);
userSession.logIn().addPermission(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());
}
Aggregations