aboutsummaryrefslogtreecommitdiffstats
path: root/it
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-02-17 16:19:57 +0100
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-02-17 16:23:24 +0100
commitfa327b38613d18ec445831242f84d500bf284ac3 (patch)
tree940811204fae4b23fd53a067a72b64d1cfd902c3 /it
parentf4039bbb34726f62ee61e45503c2bfa6c87dc3fb (diff)
parent3b673b37f88fc38b84244bd541d20ee9ac510486 (diff)
downloadsonarqube-fa327b38613d18ec445831242f84d500bf284ac3.tar.gz
sonarqube-fa327b38613d18ec445831242f84d500bf284ac3.zip
Merge branch 'branch-6.3'
Diffstat (limited to 'it')
-rw-r--r--it/it-tests/src/test/java/it/Category1Suite.java2
-rw-r--r--it/it-tests/src/test/java/it/administration/ProjectsAdministrationTest.java66
2 files changed, 68 insertions, 0 deletions
diff --git a/it/it-tests/src/test/java/it/Category1Suite.java b/it/it-tests/src/test/java/it/Category1Suite.java
index 067db2094d2..af6812ff25a 100644
--- a/it/it-tests/src/test/java/it/Category1Suite.java
+++ b/it/it-tests/src/test/java/it/Category1Suite.java
@@ -20,6 +20,7 @@
package it;
import com.sonar.orchestrator.Orchestrator;
+import it.administration.ProjectsAdministrationTest;
import it.administration.UsersPageTest;
import it.authorisation.ExecuteAnalysisPermissionTest;
import it.authorisation.IssuePermissionTest;
@@ -62,6 +63,7 @@ import static util.ItUtils.xooPlugin;
@Suite.SuiteClasses({
// administration
UsersPageTest.class,
+ ProjectsAdministrationTest.class,
// project administration
BulkDeletionTest.class,
ProjectAdministrationTest.class,
diff --git a/it/it-tests/src/test/java/it/administration/ProjectsAdministrationTest.java b/it/it-tests/src/test/java/it/administration/ProjectsAdministrationTest.java
new file mode 100644
index 00000000000..c6258e7b886
--- /dev/null
+++ b/it/it-tests/src/test/java/it/administration/ProjectsAdministrationTest.java
@@ -0,0 +1,66 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.administration;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarScanner;
+import it.Category1Suite;
+import java.sql.SQLException;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.sonarqube.ws.client.permission.RemoveGroupWsRequest;
+import pageobjects.Navigation;
+
+import static com.codeborne.selenide.Condition.text;
+import static com.codeborne.selenide.Selenide.$;
+import static util.ItUtils.newAdminWsClient;
+import static util.ItUtils.projectDir;
+
+public class ProjectsAdministrationTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
+
+ @Rule
+ public Navigation nav = Navigation.get(orchestrator);
+
+ @Before
+ public void deleteAnalysisData() throws SQLException {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void return_all_projects_even_when_no_permission() throws Exception {
+ orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")).setProperties("sonar.projectKey", "sample1"));
+ orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")).setProperties("sonar.projectKey", "sample2"));
+ // Remove 'Browse' permission from anyone and 'Admin' permission for admin group on project 2 -> No one can access or admin this
+ // project, expect System Admin
+ newAdminWsClient(orchestrator).permissions().removeGroup(new RemoveGroupWsRequest().setProjectKey("sample2").setGroupName("Anyone").setPermission("user"));
+ newAdminWsClient(orchestrator).permissions().removeGroup(new RemoveGroupWsRequest().setProjectKey("sample2").setGroupName("sonar-administrators").setPermission("admin"));
+
+ nav.logIn().asAdmin().open("/projects_admin");
+ $(".data.zebra")
+ .shouldHave(text("sample1"))
+ .shouldHave(text("sample2"));
+ }
+
+}