aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws-client/src/test/java/org/sonar
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-06-03 11:16:23 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-06-03 11:16:23 +0200
commit507e8b9a0c214ca86722af265cb3fa81c3d0c09f (patch)
tree1e8e09d3197c8eda121a414ab57a4b9ba4118c40 /sonar-ws-client/src/test/java/org/sonar
parent6ce3ec7f1b3f0b3c1baf823037873bdd672af4e5 (diff)
downloadsonarqube-507e8b9a0c214ca86722af265cb3fa81c3d0c09f.tar.gz
sonarqube-507e8b9a0c214ca86722af265cb3fa81c3d0c09f.zip
SONAR-4315 Add Issue Action WS and add Action links to Issue detail
Diffstat (limited to 'sonar-ws-client/src/test/java/org/sonar')
-rw-r--r--sonar-ws-client/src/test/java/org/sonar/wsclient/issue/DefaultIssueClientTest.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/DefaultIssueClientTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/DefaultIssueClientTest.java
index 41118a61ff9..7ad6f6df3c8 100644
--- a/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/DefaultIssueClientTest.java
+++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/issue/DefaultIssueClientTest.java
@@ -179,4 +179,34 @@ public class DefaultIssueClientTest {
assertThat(comment.login()).isEqualTo("admin");
assertThat(comment.createdAt().getDate()).isEqualTo(18);
}
+
+ @Test
+ public void should_get_actions() {
+ HttpRequestFactory requestFactory = new HttpRequestFactory(httpServer.url());
+ httpServer.doReturnBody("{\n" +
+ " \"actions\": [\n" +
+ " \"link-to-jira\",\n" +
+ " \"tweet\"\n" +
+ " ]\n" +
+ "}");
+
+ IssueClient client = new DefaultIssueClient(requestFactory);
+ List<String> actions = client.actions("ABCDE");
+
+ assertThat(httpServer.requestedPath()).isEqualTo("/api/issues/actions?issue=ABCDE");
+ assertThat(actions).hasSize(2);
+ assertThat(actions).containsOnly("link-to-jira", "tweet");
+ }
+
+ @Test
+ public void should_apply_action() {
+ HttpRequestFactory requestFactory = new HttpRequestFactory(httpServer.url());
+ httpServer.doReturnBody("{\"issue\": {\"key\": \"ABCDE\"}}");
+
+ IssueClient client = new DefaultIssueClient(requestFactory);
+ Issue result = client.doAction("ABCDE", "tweet");
+
+ assertThat(httpServer.requestedPath()).isEqualTo("/api/issues/do_action?issue=ABCDE&actionKey=tweet");
+ assertThat(result).isNotNull();
+ }
}