aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/tests/api/check-params.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/server/tests/api/check-params.js b/server/tests/api/check-params.js
index e361147bb..f060b2ad4 100644
--- a/server/tests/api/check-params.js
+++ b/server/tests/api/check-params.js
@@ -581,30 +581,28 @@ describe('Test parameters validator', function () {
581 requestsUtils.makePostBodyRequest(server.url, path, 'super token', data, done, 401) 581 requestsUtils.makePostBodyRequest(server.url, path, 'super token', data, done, 401)
582 }) 582 })
583 583
584 it('Should succeed with the correct params', function (done) { 584 it('Should fail if we add a user with the same username', function (done) {
585 const data = { 585 const data = {
586 username: 'user1', 586 username: 'user1',
587 password: 'my super password' 587 password: 'my super password'
588 } 588 }
589 589
590 requestsUtils.makePostBodyRequest(server.url, path, server.accessToken, data, done, 204) 590 requestsUtils.makePostBodyRequest(server.url, path, server.accessToken, data, done, 409)
591 }) 591 })
592 592
593 it('Should fail if we add a user with the same username', function (done) { 593 it('Should succeed with the correct params', function (done) {
594 it('Should succeed with the correct params', function (done) { 594 const data = {
595 const data = { 595 username: 'user2',
596 username: 'user1', 596 password: 'my super password'
597 password: 'my super password' 597 }
598 }
599 598
600 requestsUtils.makePostBodyRequest(server.url, path, server.accessToken, data, done, 409) 599 requestsUtils.makePostBodyRequest(server.url, path, server.accessToken, data, done, 204)
601 })
602 }) 600 })
603 601
604 it('Should fail with a non admin user', function (done) { 602 it('Should fail with a non admin user', function (done) {
605 server.user = { 603 server.user = {
606 username: 'user1', 604 username: 'user1',
607 password: 'my super password' 605 password: 'password'
608 } 606 }
609 607
610 loginUtils.loginAndGetAccessToken(server, function (err, accessToken) { 608 loginUtils.loginAndGetAccessToken(server, function (err, accessToken) {
@@ -613,7 +611,7 @@ describe('Test parameters validator', function () {
613 userAccessToken = accessToken 611 userAccessToken = accessToken
614 612
615 const data = { 613 const data = {
616 username: 'user2', 614 username: 'user3',
617 password: 'my super password' 615 password: 'my super password'
618 } 616 }
619 617