2014-06-24 12:14:26 -04:00
|
|
|
common = require '../common'
|
|
|
|
|
|
|
|
describe 'recalculate statistics', ->
|
|
|
|
url = getURL '/admin/user/recalculate/'
|
|
|
|
|
|
|
|
it 'does not allow regular users', (done) ->
|
|
|
|
loginJoe ->
|
|
|
|
request.post {uri:url + 'gamesCompleted'}, (err, res, body) ->
|
|
|
|
expect(res.statusCode).toBe 403
|
|
|
|
done()
|
|
|
|
|
|
|
|
it 'responds with a 202 Accepted', (done) ->
|
|
|
|
loginAdmin ->
|
|
|
|
request.post {uri:url + 'gamesCompleted'}, (err, res, body) ->
|
|
|
|
expect(res.statusCode).toBe 202
|
|
|
|
done()
|
|
|
|
|
2014-07-23 07:06:51 -04:00
|
|
|
xit 'responds with a 404 if handler not found', (done) ->
|
2014-06-24 12:14:26 -04:00
|
|
|
loginAdmin ->
|
2014-07-23 07:06:51 -04:00
|
|
|
request.post {uri:getURL '/admin/blobfish/swim'}, (err, res, body) ->
|
|
|
|
expect(res.statusCode).toBe 404
|
|
|
|
done()
|
|
|
|
|
|
|
|
it 'responds with a 404 if handler method not found', (done) ->
|
|
|
|
loginAdmin ->
|
|
|
|
request.post {uri:getURL '/admin/user/hammertime'}, (err, res, body) ->
|
2014-06-24 12:14:26 -04:00
|
|
|
expect(res.statusCode).toBe 404
|
|
|
|
done()
|
|
|
|
|
2014-07-23 07:06:51 -04:00
|
|
|
it 'responds with a 404 if recalculate method not found', (done) ->
|
|
|
|
loginAdmin ->
|
|
|
|
request.post {uri:url + 'ballsKicked'}, (err, res, body) ->
|
|
|
|
expect(res.statusCode).toBe 404
|
|
|
|
done()
|