Skip to content

Commit

Permalink
Add test for project with no releases
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-richardson committed Feb 21, 2016
1 parent 43d978c commit 9c5b6ff
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,17 @@ public void testGetDeploymentsWhenMultipleEnvironments() throws Exception {
Assert.assertEquals(deployment.toString(), "Environments-21;2016-01-21T14:25:53.700+00:00;2016-01-21T14:25:53.700+00:00");
}

public void testGetDeploymentsWhenNoReleases() throws Exception {
HttpContentProvider contentProvider = new FakeContentProvider(octopusUrl, octopusApiKey);
OctopusDeploymentsProvider deploymentsProvider = new OctopusDeploymentsProvider(contentProvider, LOG);
Deployments oldDeployments = new Deployments();
Deployments newDeployments = deploymentsProvider.getDeployments("Project with no releases", oldDeployments);
Assert.assertEquals(newDeployments.length(), 1);
Deployment deployment = newDeployments.getDeploymentForEnvironment("Environments-1");
Assert.assertNotNull(deployment);
Assert.assertEquals(deployment.toString(), "Environments-1;1970-01-01T00:00:00.000+00:00;1970-01-01T00:00:00.000+00:00");
}

public void testWhenThereAreTwoNewDeploymentsSinceLastCheckItReturnsOnlyOne() throws Exception {
HttpContentProvider contentProvider = new FakeContentProvider(octopusUrl, octopusApiKey);
OctopusDeploymentsProvider deploymentsProvider = new OctopusDeploymentsProvider(contentProvider, LOG);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Environments": [
{
"Id": "Environments-1",
"Name": "local"
}
],
"Releases": [],
"Links": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,39 @@
"Logo": "/api/projects/Projects-26/logo"
}
},
{
"Id": "Projects-101",
"VariableSetId": "variableset-Projects-101",
"DeploymentProcessId": "deploymentprocess-Projects-101",
"IncludedLibraryVariableSetIds": [],
"DefaultToSkipIfAlreadyInstalled": false,
"VersioningStrategy": {
"DonorPackageStepId": null,
"Template": "#{Octopus.Version.LastMajor}.#{Octopus.Version.LastMinor}.#{Octopus.Version.NextPatch}"
},
"ReleaseCreationStrategy": {
"ReleaseCreationPackageStepId": null,
"ChannelId": null
},
"Name": "Project with no releases",
"Slug": "project-with-no-releases",
"Description": "",
"IsDisabled": false,
"ProjectGroupId": "ProjectGroups-1",
"LifecycleId": "Lifecycles-1",
"AutoCreateRelease": false,
"Links": {
"Self": "/api/projects/Projects-101",
"Releases": "/api/projects/Projects-101/releases{/version}{?skip}",
"Channels": "/api/projects/Projects-101/channels",
"OrderChannels": "/api/projects/Projects-101/channels/order",
"Variables": "/api/variables/variableset-Projects-101",
"Progression": "/api/progression/Projects-101",
"DeploymentProcess": "/api/deploymentprocesses/deploymentprocess-Projects-101",
"Web": "/app#/projects/Projects-101",
"Logo": "/api/projects/Projects-101/logo"
}
},
{
"Id": "Projects-25",
"VariableSetId": "variableset-Projects-25",
Expand Down

0 comments on commit 9c5b6ff

Please sign in to comment.