mirror of
https://github.com/sismics/docs.git
synced 2025-12-18 04:01:42 +00:00
Closes #208: display file content + fix filename encoding
This commit is contained in:
@@ -580,6 +580,16 @@ public class TestDocumentResource extends BaseJerseyTest {
|
||||
Assert.assertTrue(fileBytes.length > 0); // Images rendered from PDF differ in size from OS to OS due to font issues
|
||||
Assert.assertEquals(MimeType.IMAGE_JPEG, MimeTypeUtil.guessMimeType(fileBytes, null));
|
||||
|
||||
// Get the content data
|
||||
response = target().path("/file/" + file1Id + "/data")
|
||||
.queryParam("size", "content")
|
||||
.request()
|
||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, documentPlainToken)
|
||||
.get();
|
||||
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
|
||||
is = (InputStream) response.getEntity();
|
||||
Assert.assertTrue(new String(ByteStreams.toByteArray(is)).contains("love"));
|
||||
|
||||
// Export a document in PDF format
|
||||
response = target().path("/document/" + document1Id + "/pdf")
|
||||
.queryParam("margin", "10")
|
||||
|
||||
@@ -106,6 +106,14 @@ public class TestFileResource extends BaseJerseyTest {
|
||||
Assert.assertEquals(MimeType.IMAGE_JPEG, MimeTypeUtil.guessMimeType(fileBytes, null));
|
||||
Assert.assertTrue(fileBytes.length > 0);
|
||||
|
||||
// Get the content data
|
||||
response = target().path("/file/" + file1Id + "/data")
|
||||
.queryParam("size", "content")
|
||||
.request()
|
||||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, file1Token)
|
||||
.get();
|
||||
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
|
||||
|
||||
// Get the web data
|
||||
response = target().path("/file/" + file1Id + "/data")
|
||||
.queryParam("size", "web")
|
||||
|
||||
Reference in New Issue
Block a user