1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/test/functional/adduser.js

48 lines
1.3 KiB
JavaScript
Raw Normal View History

2014-07-22 23:45:28 +02:00
var Server = require('./lib/server')
2017-01-19 16:14:39 +01:00
var fs = require('fs')
var path = require('path')
2014-07-22 23:45:28 +02:00
module.exports = function() {
var server = new Server('http://localhost:55551/')
2014-07-22 23:45:28 +02:00
describe('adduser', function() {
var user = String(Math.random())
var pass = String(Math.random())
before(function () {
return server.auth(user, pass)
.status(201)
.body_ok(/user .* created/)
})
2014-07-22 23:45:28 +02:00
it('creating new user', function(){})
2014-07-22 23:45:28 +02:00
it('should log in', function () {
return server.auth(user, pass)
.status(201)
.body_ok(/you are authenticated as/)
})
2014-07-22 23:45:28 +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/)
})
})
2017-01-19 16:14:39 +01:00
describe('adduser created with htpasswd', function() {
var user = 'preexisting'
var pass = 'preexisting'
before(function () {
return fs.appendFileSync(
path.join(__dirname, 'test-storage', '.htpasswd'),
'preexisting:$apr1$4YSboUa9$yVKjE7.PxIOuK3M4D7VjX.'
)
})
it('should log in', function () {
return server.auth(user, pass)
.status(201)
.body_ok(/you are authenticated as/)
})
})
2014-07-22 23:45:28 +02:00
}