Skip to content

Commit

Permalink
Merge pull request #182 from henryju/master
Browse files Browse the repository at this point in the history
Fix invalid URL for pull request comments update/delete
  • Loading branch information
kohsuke committed Jul 17, 2015
2 parents efa48ac + 492ff58 commit c4113f1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public URL getHtmlUrl() {
}

protected String getApiRoute() {
return "/repos/"+owner.getRepository().getFullName()+"/comments/"+id;
return "/repos/"+owner.getRepository().getFullName()+"/pulls/comments/"+id;
}

/**
Expand Down
37 changes: 35 additions & 2 deletions src/test/java/org/kohsuke/github/PullRequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.io.IOException;
import java.util.Collection;
import java.util.List;

/**
* @author Kohsuke Kawaguchi
Expand All @@ -18,7 +19,38 @@ public void createPullRequest() throws Exception {
assertEquals(name, p.getTitle());
}

@Test // Requires push access to the test repo to pass
@Test
public void createPullRequestComment() throws Exception {
String name = rnd.next();
GHPullRequest p = getRepository().createPullRequest(name, "stable", "master", "## test");
p.comment("Some comment");
}

@Test
public void testPullRequestReviewComments() throws Exception {
String name = rnd.next();
GHPullRequest p = getRepository().createPullRequest(name, "stable", "master", "## test");
System.out.println(p.getUrl());
assertTrue(p.listReviewComments().asList().isEmpty());
p.createReviewComment("Sample review comment", p.getHead().getSha(), "cli/pom.xml", 5);
List<GHPullRequestReviewComment> comments = p.listReviewComments().asList();
assertEquals(1, comments.size());
GHPullRequestReviewComment comment = comments.get(0);
assertEquals("Sample review comment", comment.getBody());

comment.update("Updated review comment");
comments = p.listReviewComments().asList();
assertEquals(1, comments.size());
comment = comments.get(0);
assertEquals("Updated review comment", comment.getBody());

comment.delete();
comments = p.listReviewComments().asList();
assertTrue(comments.isEmpty());
}

@Test
// Requires push access to the test repo to pass
public void setLabels() throws Exception {
GHPullRequest p = getRepository().createPullRequest(rnd.next(), "stable", "master", "## test");
String label = rnd.next();
Expand All @@ -29,7 +61,8 @@ public void setLabels() throws Exception {
assertEquals(label, labels.iterator().next().getName());
}

@Test // Requires push access to the test repo to pass
@Test
// Requires push access to the test repo to pass
public void setAssignee() throws Exception {
GHPullRequest p = getRepository().createPullRequest(rnd.next(), "stable", "master", "## test");
GHMyself user = gitHub.getMyself();
Expand Down

0 comments on commit c4113f1

Please sign in to comment.