2014-07-23 01:45:28 +04:00
|
|
|
var Server = require('./lib/server')
|
|
|
|
|
|
|
|
module.exports = function() {
|
2014-11-12 14:14:37 +03:00
|
|
|
var server = new Server('http://localhost:55551/')
|
2014-07-23 01:45:28 +04:00
|
|
|
|
2014-11-12 14:14:37 +03:00
|
|
|
describe('adduser', function() {
|
|
|
|
var user = String(Math.random())
|
|
|
|
var pass = String(Math.random())
|
2015-04-11 20:11:04 +03:00
|
|
|
before(function () {
|
|
|
|
return server.auth(user, pass)
|
|
|
|
.status(201)
|
|
|
|
.body_ok(/user .* created/)
|
2014-11-12 14:14:37 +03:00
|
|
|
})
|
2014-07-23 01:45:28 +04:00
|
|
|
|
2014-11-12 14:14:37 +03:00
|
|
|
it('creating new user', function(){})
|
2014-07-23 01:45:28 +04:00
|
|
|
|
2015-04-11 20:11:04 +03:00
|
|
|
it('should log in', function () {
|
|
|
|
return server.auth(user, pass)
|
|
|
|
.status(201)
|
|
|
|
.body_ok(/you are authenticated as/)
|
2014-11-12 14:14:37 +03:00
|
|
|
})
|
2014-07-23 01:45:28 +04:00
|
|
|
|
2015-04-11 20:11:04 +03: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 14:14:37 +03:00
|
|
|
})
|
|
|
|
})
|
2014-07-23 01:45:28 +04:00
|
|
|
}
|