OLMIS-856 : There should be not possibility to create few users with the same username.

Test Case #:856

Test Case Name: There should be not possibility to create few users with the same username.

System: OpenLMIS

Subsystem:Requisition

Test case designed by: Piotr Żurawski

Design Date:25.07.2016

Short description: Check if OpenLMIS is blocking creating more than one account with the same username.

                                                                                                                                                   

Pre – conditions:

                                                                                                                                                                                                                                                       

 

 

Step

Action

Expected system response

Comment

1

Create user.

Method: POST.

URL: http://localhost:8080/api/users

Body:

{
"username":"lmisUserName",
"password":"lmisPassw",
"firstName":"olmisFirstName",
"lastName":"olmisLastName"
}

                                                          

{
"username": "lmisUserName",
"firstName": "olmisFirstName",
"lastName": "olmisLastName",
"verified": false,
"active": false,
"_links": {
"self": {
"href": "http://localhost:8080/api/users/f4d84f0e-6d49-419f-bda8-6a7609b369c1"
},
"user": {
"href": "http://localhost:8080/api/users/f4d84f0e-6d49-419f-bda8-6a7609b369c1"
},
"roles": {
"href": "http://localhost:8080/api/users/f4d84f0e-6d49-419f-bda8-6a7609b369c1/roles"
},
"homeFacility": {
"href": "http://localhost:8080/api/users/f4d84f0e-6d49-419f-bda8-6a7609b369c1/homeFacility"
}
}
}

           

2

Try to create account with the same username(repeat step no. 1).

{
"cause": {
"cause": {
"cause": null,
"message": "ERROR: duplicate key value violates unique constraint \"uk_r43af9ap4edm43mmtq01oddj6\"\n Detail: Key (username)=(lmisUserName) already exists."
},
"message": "could not execute statement"
},
"message": "could not execute statement; SQL [n/a]; constraint [uk_r43af9ap4edm43mmtq01oddj6]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement"
}

 

 

Post – conditions:

                                                                                                                   

OpenLMIS: the global initiative for powerful LMIS software