aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>2017-09-28 15:37:42 +0200
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>2017-09-29 15:32:54 +0200
commit006ead5557ffd0345eec67134777eee76b0063ec (patch)
tree54d24b61a00acd74b7cdf1e56daaad80c24b4031 /server
parent26f94d773aad86a16ddb7a85354083cdcea07458 (diff)
downloadsonarqube-006ead5557ffd0345eec67134777eee76b0063ec.tar.gz
sonarqube-006ead5557ffd0345eec67134777eee76b0063ec.zip
SONAR-9127 add unit test of the definition of api/qualitygates/get_by_project
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java
index 6a26415520f..4945ff91435 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/GetByProjectActionTest.java
@@ -23,6 +23,7 @@ import javax.annotation.Nullable;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.sonar.api.server.ws.WebService;
import org.sonar.api.utils.System2;
import org.sonar.api.web.UserRole;
import org.sonar.db.DbClient;
@@ -66,6 +67,21 @@ public class GetByProjectActionTest {
new GetByProjectAction(userSession, dbClient, TestComponentFinder.from(db), new QualityGateFinder(dbClient)));
@Test
+ public void definition() {
+ WebService.Action def = ws.getDef();
+ assertThat(def.description()).isNotEmpty();
+ assertThat(def.isInternal()).isTrue();
+ assertThat(def.since()).isEqualTo("6.1");
+ assertThat(def.changelog()).isEmpty();
+ assertThat(def.params()).extracting(WebService.Param::key).containsExactlyInAnyOrder("projectId", "projectKey");
+
+ WebService.Param projectKey = def.param("projectKey");
+ assertThat(projectKey.description()).isNotEmpty();
+ assertThat(projectKey.isRequired()).isFalse();
+ assertThat(projectKey.exampleValue()).isNotEmpty();
+ }
+
+ @Test
public void json_example() {
OrganizationDto organizationDto = db.organizations().insert();
ComponentDto project = componentDb.insertComponent(ComponentTesting.newPrivateProjectDto(organizationDto));