Fix up acceptance tests

This commit is contained in:
Shane Kilkelly 2018-09-24 11:32:15 +01:00
parent 2ef23194df
commit 70b56d0362
2 changed files with 2 additions and 15 deletions

View file

@ -263,21 +263,8 @@ describe "Sessions", ->
@user3 = new User()
@user3.email = @user1.email
@user3.password = @user1.password
v1Id = 2345
v1User2 = {
id: v1Id,
email: @user2.email,
password: @user2.password,
profile:
id: v1Id,
email: @user2.email
}
async.series [
@user2.login.bind(@user2)
(cb) => @user2.mongoUpdate {$set: {'overleaf.id': v1Id}}, cb
(cb) =>
MockV1Api.setUser v1Id, v1User2
cb()
@user2.activateSudoMode.bind(@user2)
], done

View file

@ -78,14 +78,14 @@ module.exports = MockV1Api =
app.post "/api/v1/sharelatex/login", (req, res, next) =>
for id, user of @users
if user.email == req.body.email && user.password == req.body.password
if user? && user.email == req.body.email && user.password == req.body.password
return res.json {
email: user.email,
valid: true,
user_profile: user.profile
}
return res.status(403).json {
email: user.email,
email: req.body.email,
valid: false
}