diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2017-04-27 11:19:35 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2017-04-28 18:36:09 +0200 |
commit | e4390c1826c0e886be3bda201cac7f4401771778 (patch) | |
tree | f04a56c2ed8173825c2815b4df13bd4f33299380 /it | |
parent | 1eed5d9bfbf46bc9ffc0b7d7673a3beaf2b9c9a6 (diff) | |
download | sonarqube-e4390c1826c0e886be3bda201cac7f4401771778.tar.gz sonarqube-e4390c1826c0e886be3bda201cac7f4401771778.zip |
SONAR-9162 Add a flag in api/navigation/component to know if project can become private
Diffstat (limited to 'it')
-rw-r--r-- | it/it-tests/src/test/java/it/organization/BillingTest.java | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/it/it-tests/src/test/java/it/organization/BillingTest.java b/it/it-tests/src/test/java/it/organization/BillingTest.java index 11a94a9f7ff..a78fdfc3a66 100644 --- a/it/it-tests/src/test/java/it/organization/BillingTest.java +++ b/it/it-tests/src/test/java/it/organization/BillingTest.java @@ -68,12 +68,12 @@ public class BillingTest { public static void prepare() throws Exception { adminClient = newAdminWsClient(orchestrator); enableOrganizationsSupport(); - resetSettings(orchestrator, "sonar.billing.preventProjectAnalysis"); } @Before public void setUp() throws Exception { userRule.deactivateUsers(USER_LOGIN); + resetSettings(orchestrator, "sonar.billing.preventProjectAnalysis"); } @AfterClass @@ -106,7 +106,7 @@ public class BillingTest { } @Test - public void api_navigation_organization_return_canUpdateProjectsVisibilityToPrivate() { + public void api_navigation_organization_returns_canUpdateProjectsVisibilityToPrivate() { String organizationKey = createOrganization(); userRule.createUser(USER_LOGIN, USER_LOGIN); adminClient.organizations().addMember(organizationKey, USER_LOGIN); @@ -121,6 +121,19 @@ public class BillingTest { assertWsResponseAsUser(new GetRequest("api/navigation/organization").setParam("organization", organizationKey), "\"canUpdateProjectsVisibilityToPrivate\":false"); } + @Test + public void api_navigation_component_returns_canUpdateProjectVisibilityToPrivate() { + String organizationKey = createOrganization(); + String projectKey = newProjectKey(); + executeAnalysis(projectKey, organizationKey); + + setServerProperty(orchestrator, "sonar.billing.preventUpdatingProjectsVisibilityToPrivate", "false"); + assertWsResponseAsAdmin(new GetRequest("api/navigation/component").setParam("componentKey", projectKey), "\"canUpdateProjectVisibilityToPrivate\":true"); + + setServerProperty(orchestrator, "sonar.billing.preventUpdatingProjectsVisibilityToPrivate", "true"); + assertWsResponseAsAdmin(new GetRequest("api/navigation/component").setParam("componentKey", projectKey), "\"canUpdateProjectVisibilityToPrivate\":false"); + } + private static String createOrganization() { String key = newOrganizationKey(); adminClient.organizations().create(new CreateWsRequest.Builder().setKey(key).setName(key).build()).getOrganization(); @@ -128,9 +141,13 @@ public class BillingTest { } private static String executeAnalysis(String organizationKey) { + return executeAnalysis(newProjectKey(), organizationKey); + } + + private static String executeAnalysis(String projectKey, String organizationKey) { BuildResult buildResult = orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"), "sonar.organization", organizationKey, - "sonar.projectKey", newProjectKey(), + "sonar.projectKey", projectKey, "sonar.login", "admin", "sonar.password", "admin")); return ItUtils.extractCeTaskId(buildResult); |