PullRequest.setMilestone should use the Issue API

This commit is contained in:
George Gastaldi
2020-07-24 18:47:41 -03:00
parent 2b2be05dae
commit 36ab05c265
22 changed files with 2522 additions and 3 deletions

View File

@@ -70,6 +70,24 @@ public class GHMilestoneTest extends AbstractGitHubWireMockTest {
assertEquals(null, issue.getMilestone());
}
@Test
public void testUnsetMilestoneFromPullRequest() throws IOException {
GHRepository repo = getRepository();
GHMilestone milestone = repo.createMilestone("Unset Test Milestone", "For testUnsetMilestone");
GHPullRequest p = getRepository()
.createPullRequest("testUnsetMilestoneFromPullRequest", "test/stable", "master", "## test");
// set the milestone
p.setMilestone(milestone);
p = repo.getPullRequest(p.getNumber()); // force reload
assertEquals(milestone.getNumber(), p.getMilestone().getNumber());
// remove the milestone
p.setMilestone(null);
p = repo.getPullRequest(p.getNumber()); // force reload
assertNull(p.getMilestone());
}
protected GHRepository getRepository() throws IOException {
return getRepository(gitHub);
}