diff --git a/services/web/test/UnitTests/coffee/Compile/ClsiManagerTests.coffee b/services/web/test/UnitTests/coffee/Compile/ClsiManagerTests.coffee index f02c228ad6..6786c3a1a8 100644 --- a/services/web/test/UnitTests/coffee/Compile/ClsiManagerTests.coffee +++ b/services/web/test/UnitTests/coffee/Compile/ClsiManagerTests.coffee @@ -262,12 +262,12 @@ describe "ClsiManager", -> .calledWith(@project_id, {compiler:1, rootDoc_id: 1, imageName: 1, rootFolder: 1}) .should.equal true - it "should flush the project to the database", -> + it "should not explicitly flush the project to the database", -> @DocumentUpdaterHandler.flushProjectToMongo .calledWith(@project_id) - .should.equal true + .should.equal false - it "should get only the live docs from the docupdater", -> + it "should get only the live docs from the docupdater with a background flush in docupdater", -> @DocumentUpdaterHandler.getProjectDocsIfMatch .calledWith(@project_id) .should.equal true diff --git a/services/web/test/UnitTests/coffee/DocumentUpdater/DocumentUpdaterHandlerTests.coffee b/services/web/test/UnitTests/coffee/DocumentUpdater/DocumentUpdaterHandlerTests.coffee index b2cbeeba16..d7e88a6615 100644 --- a/services/web/test/UnitTests/coffee/DocumentUpdater/DocumentUpdaterHandlerTests.coffee +++ b/services/web/test/UnitTests/coffee/DocumentUpdater/DocumentUpdaterHandlerTests.coffee @@ -265,19 +265,19 @@ describe 'DocumentUpdaterHandler', -> v: @version @docs = [ @doc0, @doc0, @doc0 ] @body = JSON.stringify @docs - @request.get = sinon.stub().callsArgWith(1, null, {statusCode: 200}, @body) + @request.post = sinon.stub().callsArgWith(1, null, {statusCode: 200}, @body) @handler.getProjectDocsIfMatch @project_id, @project_state_hash, @callback it 'should get the documenst from the document updater', -> - url = "#{@settings.apis.documentupdater.url}/project/#{@project_id}/doc?state=#{@project_state_hash}" - @request.get.calledWith(url).should.equal true + url = "#{@settings.apis.documentupdater.url}/project/#{@project_id}/get_and_flush_if_old?state=#{@project_state_hash}" + @request.post.calledWith(url).should.equal true it "should call the callback with the documents", -> @callback.calledWithExactly(null, @docs).should.equal true describe "when the document updater API returns an error", -> beforeEach -> - @request.get = sinon.stub().callsArgWith(1, @error = new Error("something went wrong"), null, null) + @request.post = sinon.stub().callsArgWith(1, @error = new Error("something went wrong"), null, null) @handler.getProjectDocsIfMatch @project_id, @project_state_hash, @callback it "should return an error to the callback", -> @@ -285,7 +285,7 @@ describe 'DocumentUpdaterHandler', -> describe "when the document updater returns a conflict error code", -> beforeEach -> - @request.get = sinon.stub().callsArgWith(1, null, { statusCode: 409 }, "Conflict") + @request.post = sinon.stub().callsArgWith(1, null, { statusCode: 409 }, "Conflict") @handler.getProjectDocsIfMatch @project_id, @project_state_hash, @callback it "should return the callback with no documents", -> @@ -312,7 +312,7 @@ describe 'DocumentUpdaterHandler', -> describe "when the document updater API returns an error", -> beforeEach -> - @request.get = sinon.stub().callsArgWith(1, @error = new Error("something went wrong"), null, null) + @request.post = sinon.stub().callsArgWith(1, @error = new Error("something went wrong"), null, null) @handler.getProjectDocsIfMatch @project_id, @project_state_hash, @callback it "should return an error to the callback", -> @@ -320,7 +320,7 @@ describe 'DocumentUpdaterHandler', -> describe "when the document updater returns a conflict error code", -> beforeEach -> - @request.get = sinon.stub().callsArgWith(1, null, { statusCode: 409 }, "Conflict") + @request.post = sinon.stub().callsArgWith(1, null, { statusCode: 409 }, "Conflict") @handler.getProjectDocsIfMatch @project_id, @project_state_hash, @callback it "should return the callback with no documents", ->