|
@@ -210,7 +210,7 @@ describe "FileStoreHandler", ->
|
|
|
@newFile_id = "new file id"
|
|
@newFile_id = "new file id"
|
|
|
|
|
|
|
|
it "should post json", (done)->
|
|
it "should post json", (done)->
|
|
|
- @request.callsArgWith(1, null)
|
|
|
|
|
|
|
+ @request.callsArgWith(1, null, {statusCode: 200})
|
|
|
|
|
|
|
|
@handler.copyFile @project_id, @file_id, @newProject_id, @newFile_id, =>
|
|
@handler.copyFile @project_id, @file_id, @newProject_id, @newFile_id, =>
|
|
|
@request.args[0][0].method.should.equal "put"
|
|
@request.args[0][0].method.should.equal "put"
|
|
@@ -220,13 +220,13 @@ describe "FileStoreHandler", ->
|
|
|
done()
|
|
done()
|
|
|
|
|
|
|
|
it "builds the correct url", (done)->
|
|
it "builds the correct url", (done)->
|
|
|
- @request.callsArgWith(1, null)
|
|
|
|
|
|
|
+ @request.callsArgWith(1, null, {statusCode: 200})
|
|
|
@handler.copyFile @project_id, @file_id, @newProject_id, @newFile_id, =>
|
|
@handler.copyFile @project_id, @file_id, @newProject_id, @newFile_id, =>
|
|
|
@handler._buildUrl.calledWith(@newProject_id, @newFile_id).should.equal true
|
|
@handler._buildUrl.calledWith(@newProject_id, @newFile_id).should.equal true
|
|
|
done()
|
|
done()
|
|
|
|
|
|
|
|
it "returns the url", (done)->
|
|
it "returns the url", (done)->
|
|
|
- @request.callsArgWith(1, null)
|
|
|
|
|
|
|
+ @request.callsArgWith(1, null, {statusCode: 200})
|
|
|
@handler.copyFile @project_id, @file_id, @newProject_id, @newFile_id, (err, url) =>
|
|
@handler.copyFile @project_id, @file_id, @newProject_id, @newFile_id, (err, url) =>
|
|
|
url.should.equal "http://filestore.stubbedBuilder.com"
|
|
url.should.equal "http://filestore.stubbedBuilder.com"
|
|
|
done()
|
|
done()
|
|
@@ -237,3 +237,10 @@ describe "FileStoreHandler", ->
|
|
|
@handler.copyFile @project_id, @file_id, @newProject_id, @newFile_id, (err)=>
|
|
@handler.copyFile @project_id, @file_id, @newProject_id, @newFile_id, (err)=>
|
|
|
err.should.equal error
|
|
err.should.equal error
|
|
|
done()
|
|
done()
|
|
|
|
|
+
|
|
|
|
|
+ it "should return an error for a non-success statusCode", (done)->
|
|
|
|
|
+ @request.callsArgWith(1, null, {statusCode: 500})
|
|
|
|
|
+ @handler.copyFile @project_id, @file_id, @newProject_id, @newFile_id, (err)=>
|
|
|
|
|
+ err.should.be.an('error')
|
|
|
|
|
+ err.message.should.equal 'non-ok response from filestore for copyFile: 500'
|
|
|
|
|
+ done()
|