use of org.sonarqube.ws.Qualitygates.SearchUsersResponse in project sonarqube by SonarSource.
the class SearchUsersActionTest method search_deselected_users.
@Test
public void search_deselected_users() {
QualityGateDto gate = db.qualityGates().insertQualityGate();
UserDto user1 = db.users().insertUser();
UserDto user2 = db.users().insertUser();
db.qualityGates().addUserPermission(gate, user1);
userSession.logIn().addPermission(ADMINISTER_QUALITY_GATES);
SearchUsersResponse response = ws.newRequest().setParam(PARAM_GATE_NAME, gate.getName()).setParam(SELECTED, "deselected").executeProtobuf(SearchUsersResponse.class);
assertThat(response.getUsersList()).extracting(SearchUsersResponse.User::getLogin, SearchUsersResponse.User::getName, SearchUsersResponse.User::getSelected).containsExactlyInAnyOrder(tuple(user2.getLogin(), user2.getName(), false));
}
use of org.sonarqube.ws.Qualitygates.SearchUsersResponse in project sonarqube by SonarSource.
the class SearchUsersActionTest method uses_global_permission.
@Test
public void uses_global_permission() {
QualityGateDto gate = db.qualityGates().insertQualityGate();
UserDto user1 = db.users().insertUser();
db.qualityGates().addUserPermission(gate, user1);
userSession.logIn().addPermission(ADMINISTER_QUALITY_GATES);
SearchUsersResponse response = ws.newRequest().setParam(PARAM_GATE_NAME, gate.getName()).setParam(SELECTED, "all").executeProtobuf(SearchUsersResponse.class);
assertThat(response.getUsersList()).extracting(SearchUsersResponse.User::getLogin).containsExactlyInAnyOrder(user1.getLogin());
}
use of org.sonarqube.ws.Qualitygates.SearchUsersResponse in project sonarqube by SonarSource.
the class SearchUsersActionTest method search_by_name.
@Test
public void search_by_name() {
QualityGateDto gate = db.qualityGates().insertQualityGate();
UserDto user1 = db.users().insertUser(u -> u.setName("John Doe"));
UserDto user2 = db.users().insertUser(u -> u.setName("Jane Doe"));
UserDto user3 = db.users().insertUser(u -> u.setName("John Smith"));
db.qualityGates().addUserPermission(gate, user1);
userSession.logIn().addPermission(ADMINISTER_QUALITY_GATES);
SearchUsersResponse response = ws.newRequest().setParam(PARAM_GATE_NAME, gate.getName()).setParam(TEXT_QUERY, "ohn").setParam(SELECTED, "all").executeProtobuf(SearchUsersResponse.class);
assertThat(response.getUsersList()).extracting(SearchUsersResponse.User::getLogin).containsExactlyInAnyOrder(user1.getLogin(), user3.getLogin());
}
use of org.sonarqube.ws.Qualitygates.SearchUsersResponse in project sonarqube by SonarSource.
the class SearchUsersActionTest method search_selected_users.
@Test
public void search_selected_users() {
QualityGateDto gate = db.qualityGates().insertQualityGate();
UserDto user1 = db.users().insertUser();
UserDto user2 = db.users().insertUser();
db.qualityGates().addUserPermission(gate, user1);
userSession.logIn().addPermission(ADMINISTER_QUALITY_GATES);
SearchUsersResponse response = ws.newRequest().setParam(PARAM_GATE_NAME, gate.getName()).setParam(SELECTED, "selected").executeProtobuf(SearchUsersResponse.class);
assertThat(response.getUsersList()).extracting(SearchUsersResponse.User::getLogin, SearchUsersResponse.User::getName, SearchUsersResponse.User::getSelected).containsExactlyInAnyOrder(tuple(user1.getLogin(), user1.getName(), true));
}
Aggregations