return url from FileStoreHandler.copyFile

This commit is contained in:
Hayden Faulds 2017-11-24 11:13:44 +00:00
parent 4ec0d07aae
commit 60ee78704a
2 changed files with 6 additions and 1 deletions

View file

@ -92,7 +92,7 @@ module.exports = FileStoreHandler =
request opts, (err)->
if err?
logger.err err:err, oldProject_id:oldProject_id, oldFile_id:oldFile_id, newProject_id:newProject_id, newFile_id:newFile_id, "something went wrong telling filestore api to copy file"
callback(err)
callback(err, opts.uri)
_buildUrl: (project_id, file_id)->
return "#{settings.apis.filestore.url}/project/#{project_id}/file/#{file_id}"

View file

@ -219,6 +219,11 @@ describe "FileStoreHandler", ->
@handler._buildUrl.calledWith(@newProject_id, @newFile_id).should.equal true
done()
it "returns the url", (done)->
@request.callsArgWith(1, null)
@handler.copyFile @project_id, @file_id, @newProject_id, @newFile_id, (err, url) =>
url.should.equal "http://filestore.stubbedBuilder.com"
done()
it "should return the err", (done)->
error = "errrror"