Fixed a couple server tests.

This commit is contained in:
Scott Erickson 2014-11-11 17:37:55 -08:00
parent d1d6a734b4
commit 56e62bb4c8
2 changed files with 12 additions and 10 deletions

View file

@ -50,15 +50,6 @@ describe 'Achievement', ->
expect(res.statusCode).toBe(403) expect(res.statusCode).toBe(403)
done() 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) -> it 'can be created by admins', (done) ->
loginAdmin -> loginAdmin ->
request.post {uri: url, json: unlockable}, (err, res, body) -> request.post {uri: url, json: unlockable}, (err, res, body) ->
@ -77,6 +68,17 @@ describe 'Achievement', ->
expect(docs.length).toBe 3 expect(docs.length).toBe 3
done() 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) -> it 'can get all for ordinary users', (done) ->
loginJoe -> loginJoe ->
request.get {uri: url, json: unlockable}, (err, res, body) -> request.get {uri: url, json: unlockable}, (err, res, body) ->

View file

@ -69,7 +69,7 @@ describe 'POST /db/user', ->
expect(user.get('password')).toBeUndefined() expect(user.get('password')).toBeUndefined()
expect(user?.get('passwordHash')).not.toBeUndefined() expect(user?.get('passwordHash')).not.toBeUndefined()
if user?.get('passwordHash')? 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) expect(user.get('permissions').length).toBe(0)
done() done()