You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2018/09/04 16:13:19 UTC

[sling-whiteboard] branch master updated: Test image contents as well

This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 829056e  Test image contents as well
829056e is described below

commit 829056e6528718a2c1e33d9015c976972bee276c
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Sep 4 18:13:10 2018 +0200

    Test image contents as well
---
 .../src/test/java/sling/filestorage/uploadImage.feature    | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/karate-http-testing/src/test/java/sling/filestorage/uploadImage.feature b/karate-http-testing/src/test/java/sling/filestorage/uploadImage.feature
index ecfe034..a51d829 100644
--- a/karate-http-testing/src/test/java/sling/filestorage/uploadImage.feature
+++ b/karate-http-testing/src/test/java/sling/filestorage/uploadImage.feature
@@ -23,7 +23,7 @@ Scenario: Upload an image, read back and check
 # ------------------------------------------------------------------------
 
 # Create a resource
-Given path testFolderPath + '/*'
+Given path testFolderPath + "/*"
 And multipart field file = read("classpath:images/testimage.jpg")
 And multipart field name = filename
 When method POST
@@ -32,7 +32,7 @@ Then status 201
 # The Location header provides the path where the resource was created
 * def imagePath = responseHeaders['Location'][0]
 
-# Read metadata back
+# Read metadata back and verify
 Given path imagePath + '.tidy.5.json'
 When method GET
 Then status 200
@@ -41,9 +41,17 @@ And match response.name == filename
 And match response.file.jcr:primaryType == 'nt:resource'
 And match response.file.jcr:mimeType == 'application/octet-stream'
 
+# Read the image itself back and verify
+Given path imagePath + '/file/jcr:data'
+When method GET
+Then status 200
+And match header Content-Type == 'application/octet-stream'
+And match response == read("classpath:images/testimage.jpg")
+And match header Content-Length == "10102"
+
 # Cleanup test content
 * table paths
   | path |
   | imagePath |
   | testFolderPath |
-* def result = call read('classpath:util/cleanup-test-content.feature') paths
\ No newline at end of file
+# * def result = call read('classpath:util/cleanup-test-content.feature') paths
\ No newline at end of file