Server: fix check user params tests
This commit is contained in:
parent
93c462b771
commit
327680c984
1 changed files with 12 additions and 14 deletions
|
@ -581,30 +581,28 @@ describe('Test parameters validator', function () {
|
||||||
requestsUtils.makePostBodyRequest(server.url, path, 'super token', data, done, 401)
|
requestsUtils.makePostBodyRequest(server.url, path, 'super token', data, done, 401)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should succeed with the correct params', function (done) {
|
it('Should fail if we add a user with the same username', function (done) {
|
||||||
const data = {
|
const data = {
|
||||||
username: 'user1',
|
username: 'user1',
|
||||||
password: 'my super password'
|
password: 'my super password'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
requestsUtils.makePostBodyRequest(server.url, path, server.accessToken, data, done, 409)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should succeed with the correct params', function (done) {
|
||||||
|
const data = {
|
||||||
|
username: 'user2',
|
||||||
|
password: 'my super password'
|
||||||
|
}
|
||||||
|
|
||||||
requestsUtils.makePostBodyRequest(server.url, path, server.accessToken, data, done, 204)
|
requestsUtils.makePostBodyRequest(server.url, path, server.accessToken, data, done, 204)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should fail if we add a user with the same username', function (done) {
|
|
||||||
it('Should succeed with the correct params', function (done) {
|
|
||||||
const data = {
|
|
||||||
username: 'user1',
|
|
||||||
password: 'my super password'
|
|
||||||
}
|
|
||||||
|
|
||||||
requestsUtils.makePostBodyRequest(server.url, path, server.accessToken, data, done, 409)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('Should fail with a non admin user', function (done) {
|
it('Should fail with a non admin user', function (done) {
|
||||||
server.user = {
|
server.user = {
|
||||||
username: 'user1',
|
username: 'user1',
|
||||||
password: 'my super password'
|
password: 'password'
|
||||||
}
|
}
|
||||||
|
|
||||||
loginUtils.loginAndGetAccessToken(server, function (err, accessToken) {
|
loginUtils.loginAndGetAccessToken(server, function (err, accessToken) {
|
||||||
|
@ -613,7 +611,7 @@ describe('Test parameters validator', function () {
|
||||||
userAccessToken = accessToken
|
userAccessToken = accessToken
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
username: 'user2',
|
username: 'user3',
|
||||||
password: 'my super password'
|
password: 'my super password'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue