Test Case #:867
Test Case Name: Assign roles to a user record for requisitions | |
System: OpenLMIS | Subsystem: blue |
Test case designed by: Lucyna Kwidzińska | Design Date:03.10.2016 |
Short description: |
|
Pre – conditions: |
Step | Action | Expected system response | Comment |
1 | Create User. URL: http://172.23.0.1/referencedata/api/users/?access_token=10bdce57-5093-4149-b68e-a9a19209f9c3 Method: PUT Body: { "username": "TestUser", "firstName": "test", "lastName": "Strator", "email": "testowysoldevelo@gmail.com", "verified": true, "active": true, "loginRestricted": true }
| User has been created. | Set a password by endpoint: /passwordReset. URL: Method: POST Body: { "username": "TestUser", "newPassword": "tests123" } |
2 | Create right with ORDER_FULFILLMENT right type.
Method: POST Body: { "name": "right01", "type": "ORDER_FULFILLMENT", "description": "OrderRight01" } | ||
3 | Create right with SUPERVISION right type. Body: { "name": "right03", "type": "SUPERVISION", "description": "SupervisionRight03" } | ||
4 | Create right with GENERAL_ADMIN right type. Body: { "name": "right05", "type": "GENERAL_ADMIN", "description": "AdminRight05" } | ||
5 | Create right with REPORTS right type. Body: { "name": "right07", "type": "REPORTS", "description": "ReportRight07" } | ||
6 | Create role with ORDER_FULFILLMENT right type. Body: { "id": "00000000-0000-0000-0000-000000000002", "name": "Order ROle", "rights": [ { "id": "a4d3ebb2-f92e-40d8-9892-cedef4f585ad", "name": "right01", "type": "ORDER_FULFILLMENT", "description": "OrderRight01" } ] } | ||
8 | Create role with SUPERVISION right type. URL: http://172.23.0.1/referencedata/api/roles?access_token=49333d29-e9c9-4fa4-acbe-ed6fc730e609 Body: { "id": "00000000-0000-0000-0000-000000000003", "name": "New Role for Supervision", "rights": [ { "id": "7db93e18-32c4-4d2d-9cc7-5a67710ad5ea", "name": "right03", "type": "SUPERVISION", "description": "SupervisionRight03" } ] } | ||
9 | Create role with GENERAL_ADMIN right type. URL: http://172.23.0.1/referencedata/api/roles?access_token=49333d29-e9c9-4fa4-acbe-ed6fc730e609 { "id": "00000000-0000-0000-0000-000000000011", "name": "New Role for Admin", "rights": [ { "id": "5f4bb0ae-31c7-4105-93f0-511fe694e6d0", "name": "right05", "type": "GENERAL_ADMIN", "description": "AdminRight05" } ] } | ||
10 | Create role with REPORTS right type. URL: http://172.23.0.1/referencedata/api/roles?access_token=49333d29-e9c9-4fa4-acbe-ed6fc730e609 Body: { "id": "00000000-0000-0000-0000-000000000005", "name": "New Role for Reports", "rights": [ { "id": "d0c1afee-9f00-4d45-bd88-66540912ff70", "name": "right07", "type": "REPORTS", "description": "ReportsRight07" } ] } | ||
11 | Create program. Body: { "code": "program01", "name": "nameprogram01", "perdiosSkippable": true } | ||
12 | Create facility. Body: { "code": "warehouse", "name": "Facility Active Enabled", "geographicZone": { "id": "b353c693-5aae-4965-9e4c-53ce6513a4df" }, "type": { "id": "f9d86969-157a-4e19-a6f2-0db1867d32a4" }, "active": "true", "enabled": "true", "openLmisAccessible": "true" } | Create geographicLevel, geographicZone and facilityType | |
13 | Create supervisoryNode. Body: { "code": "supervisorycode", "name": "supervisoryname", "description": "supervisory", "facility": { "id": "ee4f3471-2d12-434a-9449-547505f9f69d" } } | ||
14 | Assign proper facility to User. Body: { "id": "30c50771-a546-4e43-87d4-020472f430d4", "username": "TestUser", "firstName": "test", "lastName": "Strator", "email": "testowysoldevelo@gmail.com", "verified": true, "active": true, "loginRestricted": true, "homeFacility": { "id": "ee4f3471-2d12-434a-9449-547505f9f69d" } } | ||
15 | Try to assign invalid facility to User. Body: { "id": "30c50771-a546-4e43-87d4-020472f430d4", "username": "TestUser", "firstName": "test", "lastName": "Strator", "email": "testowysoldevelo@gmail.com", "verified": true, "active": true, "loginRestricted": true, "homeFacility": { "id": "224f3471-2d12-434a-9449-547505f9f69d" } } | ||
16 | Assign program to User (through role). Body: { "id": "30c50771-a546-4e43-87d4-020472f430d4", "username": "TestUser", "firstName": "test", "lastName": "Strator", "email": "testowysoldevelo@gmail.com", "verified": true, "active": true, "loginRestricted": true, "homeFacility": { "id": "ee4f3471-2d12-434a-9449-547505f9f69d" }, "roleAssignments": [ { "roleId": "00000000-0000-0000-0000-000000000003", "programCode": "program01" }, { "roleId": "00000000-0000-0000-0000-000000000001", "warehouseCode": "warehouse" }] } | ||
17 | Try to assign invalid program to User. { "id": "30c50771-a546-4e43-87d4-020472f430d4", "username": "TestUser", "firstName": "test", "lastName": "Strator", "email": "testowysoldevelo@gmail.com", "verified": true, "active": true, "loginRestricted": true, "homeFacility": { "id": "ee4f3471-2d12-434a-9449-547505f9f69d" }, "roleAssignments": [ { "roleId": "11000000-0000-0000-0000-000000000003", "programCode": "program01" }, { "roleId": "00000000-0000-0000-0000-000000000001", "warehouseCode": "warehouse" }] } | ||
18 | Assign role by program and supervisoryNode. URL: http://172.23.0.1/referencedata/api/users/?access_token=27534554-dfc6-40b8-ab58-41b5110457ab Method: PUT Body: { | ||
19 | As a User try to assign the right to another Users. | ||
20 | Delete the role as Admin. Method: DELETE |
Post – conditions: |