use of org.sonarqube.ws.WsProjects.SearchMyProjectsWsResponse in project sonarqube by SonarSource.
the class SearchMyProjectsActionTest method do_not_return_views_or_developers.
@Test
public void do_not_return_views_or_developers() {
OrganizationDto organizationDto = db.organizations().insert();
ComponentDto jdk7 = insertJdk7(organizationDto);
ComponentDto dev = insertDeveloper(organizationDto);
ComponentDto view = insertView(organizationDto);
db.users().insertProjectPermissionOnUser(user, UserRole.ADMIN, jdk7);
db.users().insertProjectPermissionOnUser(user, UserRole.ADMIN, dev);
db.users().insertProjectPermissionOnUser(user, UserRole.ADMIN, view);
SearchMyProjectsWsResponse result = call_ws();
assertThat(result.getProjectsCount()).isEqualTo(1);
assertThat(result.getProjects(0).getId()).isEqualTo(jdk7.uuid());
}
use of org.sonarqube.ws.WsProjects.SearchMyProjectsWsResponse in project sonarqube by SonarSource.
the class SearchMyProjectsActionTest method return_only_projects_when_user_is_admin.
@Test
public void return_only_projects_when_user_is_admin() {
OrganizationDto organizationDto = db.organizations().insert();
ComponentDto jdk7 = insertJdk7(organizationDto);
ComponentDto clang = insertClang(organizationDto);
db.users().insertProjectPermissionOnUser(user, UserRole.ADMIN, jdk7);
db.users().insertProjectPermissionOnUser(user, UserRole.ISSUE_ADMIN, clang);
SearchMyProjectsWsResponse result = call_ws();
assertThat(result.getProjectsCount()).isEqualTo(1);
assertThat(result.getProjects(0).getId()).isEqualTo(jdk7.uuid());
}
use of org.sonarqube.ws.WsProjects.SearchMyProjectsWsResponse in project sonarqube by SonarSource.
the class SearchMyProjectsActionTest method admin_via_groups.
@Test
public void admin_via_groups() {
OrganizationDto org = db.organizations().insert();
ComponentDto jdk7 = insertJdk7(org);
ComponentDto cLang = insertClang(org);
GroupDto group = db.users().insertGroup(org);
db.users().insertMember(group, user);
db.users().insertProjectPermissionOnGroup(group, UserRole.ADMIN, jdk7);
db.users().insertProjectPermissionOnGroup(group, UserRole.USER, cLang);
SearchMyProjectsWsResponse result = call_ws();
assertThat(result.getProjectsCount()).isEqualTo(1);
assertThat(result.getProjects(0).getId()).isEqualTo(jdk7.uuid());
}
use of org.sonarqube.ws.WsProjects.SearchMyProjectsWsResponse in project sonarqube by SonarSource.
the class SearchMyProjectsAction method handle.
@Override
public void handle(Request request, Response response) throws Exception {
SearchMyProjectsWsResponse searchMyProjectsWsResponse = doHandle(toRequest(request));
writeProtobuf(searchMyProjectsWsResponse, request, response);
}
use of org.sonarqube.ws.WsProjects.SearchMyProjectsWsResponse in project sonarqube by SonarSource.
the class SearchMyProjectsActionTest method return_only_current_user_projects.
@Test
public void return_only_current_user_projects() {
OrganizationDto organizationDto = db.organizations().insert();
ComponentDto jdk7 = insertJdk7(organizationDto);
ComponentDto cLang = insertClang(organizationDto);
UserDto anotherUser = db.users().insertUser(newUserDto());
db.users().insertProjectPermissionOnUser(user, UserRole.ADMIN, jdk7);
db.users().insertProjectPermissionOnUser(anotherUser, UserRole.ADMIN, cLang);
SearchMyProjectsWsResponse result = call_ws();
assertThat(result.getProjectsCount()).isEqualTo(1);
assertThat(result.getProjects(0).getId()).isEqualTo(jdk7.uuid());
}
Aggregations