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 = new User()
@user3.email = @user1.email @user3.email = @user1.email
@user3.password = @user1.password @user3.password = @user1.password
v1Id = 2345
v1User2 = {
id: v1Id,
email: @user2.email,
password: @user2.password,
profile:
id: v1Id,
email: @user2.email
}
async.series [ async.series [
@user2.login.bind(@user2) @user2.login.bind(@user2)
(cb) => @user2.mongoUpdate {$set: {'overleaf.id': v1Id}}, cb
(cb) =>
MockV1Api.setUser v1Id, v1User2
cb()
@user2.activateSudoMode.bind(@user2) @user2.activateSudoMode.bind(@user2)
], done ], done

View file

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