From 959191ae5019095751eeab659b50aa8aa1a3cacc Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 28 Aug 2015 14:20:14 +0100 Subject: [PATCH] Add an acceptance test for using range header when getting a file. --- .../acceptence/coffee/SendingFileTest.coffee | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/services/filestore/test/acceptence/coffee/SendingFileTest.coffee b/services/filestore/test/acceptence/coffee/SendingFileTest.coffee index 11668f230e..6408df7477 100644 --- a/services/filestore/test/acceptence/coffee/SendingFileTest.coffee +++ b/services/filestore/test/acceptence/coffee/SendingFileTest.coffee @@ -32,7 +32,7 @@ describe "Filestore", -> it "should send a 200 for status endpoing", (done)-> - request "#{@filestoreUrl}/status", (err, response, body)-> + request "#{@filestoreUrl}/status", (err, response, body)-> response.statusCode.should.equal 200 body.indexOf("filestore").should.not.equal -1 body.indexOf("up").should.not.equal -1 @@ -56,6 +56,26 @@ describe "Filestore", -> body.should.equal @constantFileContent done() + it "should be able to get back the first 8 bytes of the file", (done) -> + @timeout(1000 * 10) + options = + uri: @fileUrl + headers: + 'Range': 'bytes=0-8' + request.get options, (err, response, body)=> + body.should.equal 'hello wor' + done() + + it "should be able to get back bytes 4 through 10 of the file", (done) -> + @timeout(1000 * 10) + options = + uri: @fileUrl + headers: + 'Range': 'bytes=4-10' + request.get options, (err, response, body)=> + body.should.equal 'o world' + done() + it "should be able to delete the file", (done)-> @timeout(1000 * 20) request.del @fileUrl, (err, response, body)=> @@ -84,6 +104,3 @@ describe "Filestore", -> request.get newFileUrl, (err, response, body)=> body.should.equal @constantFileContent done() - - -