2014-07-22 23:45:28 +02:00
|
|
|
var Server = require('./lib/server')
|
|
|
|
|
|
|
|
module.exports = function() {
|
2014-11-12 12:14:37 +01:00
|
|
|
var server = new Server('http://localhost:55551/')
|
2014-07-22 23:45:28 +02:00
|
|
|
|
2014-11-12 12:14:37 +01:00
|
|
|
describe('adduser', function() {
|
|
|
|
var user = String(Math.random())
|
|
|
|
var pass = String(Math.random())
|
2015-04-11 19:11:04 +02:00
|
|
|
before(function () {
|
|
|
|
return server.auth(user, pass)
|
|
|
|
.status(201)
|
|
|
|
.body_ok(/user .* created/)
|
2014-11-12 12:14:37 +01:00
|
|
|
})
|
2014-07-22 23:45:28 +02:00
|
|
|
|
2014-11-12 12:14:37 +01:00
|
|
|
it('creating new user', function(){})
|
2014-07-22 23:45:28 +02:00
|
|
|
|
2015-04-11 19:11:04 +02:00
|
|
|
it('should log in', function () {
|
|
|
|
return server.auth(user, pass)
|
|
|
|
.status(201)
|
|
|
|
.body_ok(/you are authenticated as/)
|
2014-11-12 12:14:37 +01:00
|
|
|
})
|
2014-07-22 23:45:28 +02:00
|
|
|
|
2015-04-11 19:11:04 +02:00
|
|
|
it('should not register more users', function () {
|
|
|
|
return server.auth(String(Math.random()), String(Math.random()))
|
|
|
|
.status(409)
|
|
|
|
.body_error(/maximum amount of users reached/)
|
2014-11-12 12:14:37 +01:00
|
|
|
})
|
|
|
|
})
|
2014-07-22 23:45:28 +02:00
|
|
|
}
|