From 56e62bb4c8fe7165263081e473e77ff2aceeba53 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Tue, 11 Nov 2014 17:37:55 -0800 Subject: [PATCH] Fixed a couple server tests. --- .../server/functional/achievement.spec.coffee | 20 ++++++++++--------- test/server/functional/user.spec.coffee | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/test/server/functional/achievement.spec.coffee b/test/server/functional/achievement.spec.coffee index 8ac1ed9ef..3206bb1c1 100644 --- a/test/server/functional/achievement.spec.coffee +++ b/test/server/functional/achievement.spec.coffee @@ -50,15 +50,6 @@ describe 'Achievement', -> expect(res.statusCode).toBe(403) done() - it 'can\'t be updated by ordinary users', (done) -> - loginJoe -> - request.put {uri: url, json: unlockable}, (err, res, body) -> - expect(res.statusCode).toBe(403) - - request {method: 'patch', uri: url, json: unlockable}, (err, res, body) -> - expect(res.statusCode).toBe(403) - done() - it 'can be created by admins', (done) -> loginAdmin -> request.post {uri: url, json: unlockable}, (err, res, body) -> @@ -77,6 +68,17 @@ describe 'Achievement', -> expect(docs.length).toBe 3 done() + it 'can\'t be updated by ordinary users', (done) -> + loginJoe -> + unlockable3 = _.clone(unlockable) + unlockable3.description = 'alsdfkhasdkfhajksdhfjkasdhfj' + request.put {uri: url, json: unlockable3}, (err, res, body) -> + expect(res.statusCode).toBe(403) + + request {method: 'patch', uri: url, json: unlockable}, (err, res, body) -> + expect(res.statusCode).toBe(403) + done() + it 'can get all for ordinary users', (done) -> loginJoe -> request.get {uri: url, json: unlockable}, (err, res, body) -> diff --git a/test/server/functional/user.spec.coffee b/test/server/functional/user.spec.coffee index 29966bd2e..7335d47e7 100644 --- a/test/server/functional/user.spec.coffee +++ b/test/server/functional/user.spec.coffee @@ -69,7 +69,7 @@ describe 'POST /db/user', -> expect(user.get('password')).toBeUndefined() expect(user?.get('passwordHash')).not.toBeUndefined() if user?.get('passwordHash')? - expect(user.get('passwordHash')[..5]).toBe('31dc3d') + expect(user.get('passwordHash')[..5]).toBe('948c7e') expect(user.get('permissions').length).toBe(0) done()