Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ public class DistributionRelease {
private String currentLanguageId;
private Long currentFileId;
private Date date;
private Error error;

@Data
public static class Error {
private String message;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ public class DistributionStringsBasedRelease {
private String currentLanguageId;
private Long currentBranchId;
private Date date;
private Error error;

@Data
public static class Error {
private String message;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class DistributionsApiTest extends TestClient {
private final Long projectId = 3L;
private final Long stringsBasedProjectId = 4L;
private final String hash = "asccvfd";
private final String failedHash = "asccvfe";
private final String name = "distribution 1";
private final String name2 = "distribution 2";

Expand All @@ -44,7 +45,9 @@ public List<RequestMock> getMocks() {
RequestMock.build(this.url + "/projects/" + projectId + "/distributions/" + hash + "/release", HttpGet.METHOD_NAME, "api/distributions/release.json"),
RequestMock.build(this.url + "/projects/" + projectId + "/distributions/" + hash + "/release", HttpPost.METHOD_NAME, "api/distributions/releaseRequest.json", "api/distributions/release.json"),
RequestMock.build(this.url + "/projects/" + stringsBasedProjectId + "/distributions/" + hash + "/release", HttpGet.METHOD_NAME, "api/distributions/releaseStringsBased.json"),
RequestMock.build(this.url + "/projects/" + stringsBasedProjectId + "/distributions/" + hash + "/release", HttpPost.METHOD_NAME, "api/distributions/releaseRequest.json", "api/distributions/releaseStringsBased.json")
RequestMock.build(this.url + "/projects/" + stringsBasedProjectId + "/distributions/" + hash + "/release", HttpPost.METHOD_NAME, "api/distributions/releaseRequest.json", "api/distributions/releaseStringsBased.json"),
RequestMock.build(this.url + "/projects/" + projectId + "/distributions/" + failedHash + "/release", HttpGet.METHOD_NAME, "api/distributions/releaseFailed.json"),
RequestMock.build(this.url + "/projects/" + stringsBasedProjectId + "/distributions/" + failedHash + "/release", HttpGet.METHOD_NAME, "api/distributions/releaseStringsBasedFailed.json")
);
}

Expand Down Expand Up @@ -126,4 +129,18 @@ public void createDistributionReleaseStringsBasedTest() {
ResponseObject<DistributionStringsBasedRelease> distributionRelease = this.getDistributionsApi().createDistributionStringsBasedRelease(stringsBasedProjectId, hash);
assertEquals(distributionRelease.getData().getProgress(), new Integer(100));
}

@Test
public void getDistributionReleaseFailedTest() {
ResponseObject<DistributionRelease> distributionRelease = this.getDistributionsApi().getDistributionRelease(projectId, failedHash);
assertEquals(distributionRelease.getData().getStatus(), "failed");
assertEquals(distributionRelease.getData().getError().getMessage(), "Something went wrong");
}

@Test
public void getDistributionReleaseStringsBasedFailedTest() {
ResponseObject<DistributionStringsBasedRelease> distributionRelease = this.getDistributionsApi().getDistributionStringsBasedRelease(stringsBasedProjectId, failedHash);
assertEquals(distributionRelease.getData().getStatus(), "failed");
assertEquals(distributionRelease.getData().getError().getMessage(), "Something went wrong");
}
}
12 changes: 12 additions & 0 deletions src/test/resources/api/distributions/releaseFailed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"data": {
"status": "failed",
"progress": 42,
"currentLanguageId": "string",
"currentFileId": 0,
"date": "2019-09-23T09:04:29+00:00",
"error": {
"message": "Something went wrong"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"data": {
"status": "failed",
"progress": 42,
"currentLanguageId": "string",
"currentBranchId": 0,
"date": "2019-09-23T09:04:29+00:00",
"error": {
"message": "Something went wrong"
}
}
}
Loading