fix minor issues in acceptance test

This commit is contained in:
Henrique Dias 2015-09-16 19:33:23 -03:00
parent a4575f178d
commit 01cbfd5338
5 changed files with 14 additions and 12 deletions

View file

@ -27,13 +27,14 @@ describe "Archiving updates", ->
MockWebApi.projects[@project_id] =
features:
versioning: true
sinon.spy MockWebApi, "getProjectDetails"
MockWebApi.users[@user_id] = @user =
email: "user@sharelatex.com"
first_name: "Leo"
last_name: "Lion"
id: @user_id
sinon.spy MockWebApi, "getUser"
sinon.spy MockWebApi, "getUserInfo"
MockDocStoreApi.docs[@doc_id] = @doc =
_id: @doc_id
@ -60,7 +61,7 @@ describe "Archiving updates", ->
done()
after (done) ->
MockWebApi.getUser.restore()
MockWebApi.getUserInfo.restore()
db.docHistory.remove {project_id: ObjectId(@project_id)}
TrackChangesClient.removeS3Doc @project_id, @doc_id, done

View file

@ -28,7 +28,7 @@ describe "Getting a diff", ->
first_name: "Leo"
last_name: "Lion"
id: @user_id
sinon.spy MockWebApi, "getUser"
sinon.spy MockWebApi, "getUserInfo"
twoMinutes = 2 * 60 * 1000
@ -68,7 +68,7 @@ describe "Getting a diff", ->
after () ->
MockDocUpdaterApi.getDoc.restore()
MockWebApi.getUser.restore()
MockWebApi.getUserInfo.restore()
it "should return the diff", ->
expect(@diff).to.deep.equal @expected_diff

View file

@ -31,7 +31,7 @@ describe "Getting updates", ->
first_name: "Leo"
last_name: "Lion"
id: @user_id
sinon.spy MockWebApi, "getUser"
sinon.spy MockWebApi, "getUserInfo"
@updates = []
for i in [0..9]
@ -52,7 +52,7 @@ describe "Getting updates", ->
done()
after: () ->
MockWebApi.getUser.restore()
MockWebApi.getUserInfo.restore()
describe "getting updates up to the limit", ->
before (done) ->
@ -62,7 +62,7 @@ describe "Getting updates", ->
done()
it "should fetch the user details from the web api", ->
MockWebApi.getUser
MockWebApi.getUserInfo
.calledWith(@user_id)
.should.equal true

View file

@ -20,7 +20,7 @@ describe "Restoring a version", ->
@doc_id = ObjectId().toString()
@project_id = ObjectId().toString()
MockWebApi.projects[@project_id] = features: versioning: true
minutes = 60 * 1000
@updates = [{
@ -49,6 +49,7 @@ describe "Restoring a version", ->
first_name: "Leo"
last_name: "Lion"
id: @user_id
MockDocUpdaterApi.docs[@doc_id] =
lines: @lines
version: 7

View file

@ -6,15 +6,15 @@ module.exports = MockWebApi =
projects: {}
getUser: (user_id, callback = (error) ->) ->
getUserInfo: (user_id, callback = (error) ->) ->
callback null, @users[user_id] or null
getProject: (project_id, callback = (error, project) ->) ->
getProjectDetails: (project_id, callback = (error, project) ->) ->
callback null, @projects[project_id]
run: () ->
app.get "/user/:user_id/personal_info", (req, res, next) =>
@getUser req.params.user_id, (error, user) ->
@getUserInfo req.params.user_id, (error, user) ->
if error?
res.send 500
if !user?
@ -23,7 +23,7 @@ module.exports = MockWebApi =
res.send JSON.stringify user
app.get "/project/:project_id/details", (req, res, next) =>
@getProject req.params.project_id, (error, project) ->
@getProjectDetails req.params.project_id, (error, project) ->
if error?
res.send 500
if !project?