mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-23 15:50:48 +00:00
update deployment status checks
This commit is contained in:
@@ -175,11 +175,16 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
.create();
|
||||
assertNotNull(deployment.getCreator());
|
||||
assertNotNull(deployment.getId());
|
||||
List<GHDeployment> deployments = repository.listDeployments(null, "master", null, "unittest").toList();
|
||||
List<GHDeployment> deployments = repository
|
||||
.listDeployments(null, "master", null, "unittest")
|
||||
.toList();
|
||||
assertNotNull(deployments);
|
||||
assertFalse(Iterables.isEmpty(deployments));
|
||||
GHDeployment unitTestDeployment = deployments.get(0);
|
||||
assertEquals("unittest", unitTestDeployment.getEnvironment());
|
||||
assertEquals("unittest", unitTestDeployment.getOriginalEnvironment());
|
||||
assertEquals(false, unitTestDeployment.isProductionEnvironment());
|
||||
assertEquals(true, unitTestDeployment.isTransientEnvironment());
|
||||
assertEquals("master", unitTestDeployment.getRef());
|
||||
}
|
||||
|
||||
@@ -191,14 +196,24 @@ public class AppTest extends AbstractGitHubWireMockTest {
|
||||
.description("question")
|
||||
.payload("{\"user\":\"atmos\",\"room_id\":123456}")
|
||||
.create();
|
||||
GHDeploymentStatus ghDeploymentStatus = deployment.createStatus(GHDeploymentState.SUCCESS)
|
||||
GHDeploymentStatus ghDeploymentStatus = deployment.createStatus(GHDeploymentState.QUEUED)
|
||||
.description("success")
|
||||
.targetUrl("http://www.github.com")
|
||||
.logUrl("http://www.github.com/logurl")
|
||||
.environmentUrl("http://www.github.com/envurl")
|
||||
.environment("new-ci-env")
|
||||
.create();
|
||||
Iterable<GHDeploymentStatus> deploymentStatuses = deployment.listStatuses();
|
||||
assertNotNull(deploymentStatuses);
|
||||
assertEquals(1, Iterables.size(deploymentStatuses));
|
||||
assertEquals(ghDeploymentStatus.getId(), Iterables.get(deploymentStatuses, 0).getId());
|
||||
GHDeploymentStatus actualStatus = Iterables.get(deploymentStatuses, 0);
|
||||
assertEquals(ghDeploymentStatus.getId(), actualStatus.getId());
|
||||
assertEquals(ghDeploymentStatus.getState(), actualStatus.getState());
|
||||
assertEquals(ghDeploymentStatus.getLogUrl(), actualStatus.getLogUrl());
|
||||
// Target url was deprecated and replaced with log url. The gh api will
|
||||
// prefer the log url value and return it in target field
|
||||
assertEquals(ghDeploymentStatus.getTargetUrl(), actualStatus.getLogUrl());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user