741: Create a simple requisition with additional stock information
Test Case #: 741 | Test Case Name: Create a simple requisition with additional stock information |
System: OpenLMIS | Subsystem:Requisition |
Test case designed by: Anna Czyrko | Design Date:02.08.2016 |
Short description: Verify that:
|
|
Pre – conditions: |
Step | Action | Expected system response | Comment |
1 | Create a tocken / authentication.
URL: http://localhost:8081/oauth/token?grant_type=password&username=admin&password=password
Method: Post
Authentication: enter proper login and password | Status: 200 OK |
|
2 | Create Geographic Level entity. URL: http://localhost:8080/api/geographicLevels?access_token=7d978f65-beb0-457d-857b-de9dbd5833d8 Method: Post Example Body: { "code": "1", "name": "test", "levelNumber": "1" } | Status: 201 Created |
Remember Geographic Level id. |
3 | Create Geographic Zone entity. URL: http://localhost:8080/api/geographicZones?access_token=7d978f65-beb0-457d-857b-de9dbd5833d8 Method: Post Example Body: { "code": "test1", "name": "test1", "level": "http://localhost:8080/api/geographicLevels/51f86564-b191-41d0-bedd-b9c20c43ecca" } | Status: 201 Created | Remember Geographic Zone id. |
4 | Create Facility Type entity. URL: http://localhost:8080/api/facilityTypes?access_token=7d978f65-beb0-457d-857b-de9dbd5833d8 Method: Post Example Body: { "code": "1", "name": "test12" } | Status: 201 Created | Remember Facility Type id. |
5 | Create first Program entity. URL: http://localhost:8080/api/programs?access_token=7d978f65-beb0-457d-857b-de9dbd5833d8 Method: Post Example Body: { "code": "1", "name": "test13" } | Status: 201 Created | Remember Program id, it will be used to create supportedPrograms in Facility. |
6 | Create second Program entity. URL: http://localhost:8080/api/programs?access_token=7d978f65-beb0-457d-857b-de9dbd5833d8 Method: Post Example Body: { "code": "2", "name": "test134" } | Status: 201 Created | Remember Program id, it will be used to create supportedPrograms in Facility. |
7 | Create third Program entity. URL: http://localhost:8080/api/programs?access_token=7d978f65-beb0-457d-857b-de9dbd5833d8 Method: Post Example Body: { "code": "3", "name": "test135" } | Status: 201 Created | Remember Program id, it will be used to change supportedPrograms in Facility. |
8 | Create Facility entity. URL: http://localhost:8080/api/facilities?access_token=7d978f65-beb0-457d-857b-de9dbd5833d8 Method: Post Example Body: { "code": "test1", "geographicZone": "http://localhost:8080/api/geographicZones/597d6974-28fc-4049-9210-d8438ce41dc1", "type": "http://localhost:8080/api/facilityTypes/1f619d3a-e316-457b-9582-d13ae20397f2", "active": true, "enabled": false, "supportedPrograms":["http://localhost:8080/api/programs/27a0a233-3639-467d-a582-4b45e3ecd4ee","http://localhost:8080/api/programs/97f28dc1-885f-49c1-adc0-27032d8f1191"] } | Status: 201 Created | Remember id. |
9 | Create Schedule entity. URL: http://localhost:8080/api/schedules?access_token=7d978f65-beb0-457d-857b-de9dbd5833d8 Method: Post Example Body: { "code": "test12", "name": "testowe11" } | Status: 201 Created | Remember id. |
10 | Create Period entity. URL: http://localhost:8080/api/periods?access_token=018b7e22-bae1-4f15-b824-fa15384b1b3d Method: Post Example Body: { "processingSchedule": { "id": "8784bcbd-dbf1-4a5f-b15b-833745ce9ade", "code": "test12", "name": "testowe11" }, "name": "testName", "description": "testDescription", "startDate": "2016-07-28", "endDate": "2016-08-05" } | Status: 201 Created | Remember id. |
11 | Create productCategory entity. URL: http://localhost:8080/api/productCategories?access_token=018b7e22-bae1-4f15-b824-fa15384b1b3d Method: Post Example Body: { "code":"test1", "name":"test1234", "displayOrder":"111222" } | Status: 201 Created | Remember id. |
12 | Create product entity. URL: http://localhost:8080/api/products?access_token=018b7e22-bae1-4f15-b824-fa15384b1b3d Method: Post Example Body: { "code":"code12", "primaryName":"testName", "dispensingUnit":"testUnit", "dosesPerDispensingUnit":"3", "packSize":"4", "packRoundingThreshold":"3", "roundToZero":true, "active":true, "fullSupply":false, "tracer":true, "productCategory":"http://localhost:8080/api/productCategories/3e97f98b-90ed-457d-b99d-ccac49f47753" } | Status: 201 Created | Remember id. |
13 | Create basic Requisition URL: http://localhost:8080/api/requisitions?access_token=7a6c28bb-ed85-4e9f-bea8-efbf81737413 Method: Post Example Body: { "facility":"http://localhost:8080/api/facilities/8b0e1448-1eb8-4959-8333-793949155abc", "program":"http://localhost:8080/api/programs/27a0a233-3639-467d-a582-4b45e3ecd4ee", "processingPeriod": "http://localhost:8080/api/periods/ebfc7c6b-4b0a-413f-acef-491952122d12", "status": "INITIATED" } | Status: 201 Created
| Remember id. |
14 | Create RequisitionLines. URL: http://localhost:8080/api/requisitionLines?access_token=7a6c28bb-ed85-4e9f-bea8-efbf81737413 Method: Post Example Body: { "product":"http://localhost:8080/api/products/0638b9b0-56c5-499c-9ee7-d83721549f5f", "requisition":"http://localhost:8080/api/requisitions/4d2eaf26-54c5-4feb-9606-816803a91bb5", "stockInHand":"1", "beginningBalance":"1", "totalReceivedQuantity":"1", "totalLossesAndAdjustments":"1", "stockOnHand":"1", "requestedQuantity":"1", "totalConsumedQuantity":"1", "requestedQuantityExplanation":"TEST" } | Status: 201 Created | Remember id. |
15 | Create Requisition entity. URL: http://localhost:8080/api/requisitions?access_token=7a6c28bb-ed85-4e9f-bea8-efbf81737413 Method: Post Example Body: { "facility":"http://localhost:8080/api/facilities/8b0e1448-1eb8-4959-8333-793949155abc", "program":"http://localhost:8080/api/programs/27a0a233-3639-467d-a582-4b45e3ecd4ee" , "processingPeriod":"http://localhost:8080/api/periods/ebfc7c6b-4b0a-413f-acef-491952122d12", "emergency":true, "status":"INITIATED", "requisitionLines":["http://localhost:8080/api/requisitionLines/6a6dbf7b-395c-4c64-bb84-b5102f673a40"] } | Status: 201 Created | Remember id. |
16 | Change RequisitionLines atributes. URL: http://localhost:8080/api/requisitionLines?access_token=7a6c28bb-ed85-4e9f-bea8-efbf81737413 Method: Post Example Body: { "id": "914dbd28-f32f-4dc0-95b2-60a8227144de", "product":"http://localhost:8080/api/products/f72cb63a-a107-4ada-b46c-242257299620" , "requisition":"http://localhost:8080/api/requisitions/107a7696-c1d0-45ce-8e2f-2196c1c491cb", "stockInHand":"4", "beginningBalance":"5", "totalReceivedQuantity":"6", "totalLossesAndAdjustments":"5", "stockOnHand":"8", "requestedQuantity":"7", "totalConsumedQuantity":"5", "requestedQuantityExplanation":"TEST" } | Status: 201 Created | Remember id. |
17 | Change supportedPrograms attribute value in Facility. URL: http://localhost:8080/api/facilities?access_token=018b7e22-bae1-4f15-b824-fa15384b1b3d Method: Post Example Body: { "id":"8b0e1448-1eb8-4959-8333-793949155abc", "code": "test1", "geographicZone": "http://localhost:8080/api/geographicZones/597d6974-28fc-4049-9210-d8438ce41dc1", "type": "http://localhost:8080/api/facilityTypes/1f619d3a-e316-457b-9582-d13ae20397f2", "active": true, "enabled": false, "supportedPrograms":["http://localhost:8080/api/programs/97f28dc1-885f-49c1-adc0-27032d8f1191","http://localhost:8080/api/programs/18e1c25b-dce4-4c81-bcdc-e77af2db2d9f"] } | Status: 201 Created | Remember id. |
18 | Test following endpoint: URL: /localhost:8080/api/requisitions/009bbcbe-0cc5-4ed4-9f43-587677d830da/submit?access_token=c098cc8c-c10c-43ca-bd67-591dfb14548d Method: Post Example Body: { "id":"c9d9d880-d2e9-4010-821d-2e454f7bcc65", "facility":{"id":"d225ab0c-c8bf-44be-a16e-c1a54dca217b"}, "program":{"id":"0aac4707-5681-416f-be2c-c7419a2e4045"}, "processingPeriod":{"id":"6c2f5773-41b6-43d6-af4d-0c7688f36993"}, "emergency":true, "status":"INITIATED", "requisitionLines":[ { "id":"30239766-275d-4e11-99d4-e7d9c4568e93", "product":{"id":"43218a96-432e-489d-aa5c-fa20d82e0d1a"}, "requisition":{"id":"009bbcbe-0cc5-4ed4-9f43-587677d830da"}, "stockInHand":"1", "beginningBalance":"1", "totalReceivedQuantity":"1", "totalLossesAndAdjustments":"1", "stockOnHand":"1", "requestedQuantity":"1", "totalConsumedQuantity":"1", "requestedQuantityExplanation":"BOTAK" } ] } { "id":"6a6dbf7b-395c-4c64-bb84-b5102f673a40", "product":{"id":"0638b9b0-56c5-499c-9ee7-d83721549f5f"}, "requisition":{"id":"56110ac0-ab62-4507-b507-359cec932670"}, "stockInHand":"1", "beginningBalance":"1", "totalReceivedQuantity":"1", "totalLossesAndAdjustments":"1", "stockOnHand":"1", "requestedQuantity":"1", "totalConsumedQuantity":"1", "requestedQuantityExplanation":"TEST" } ] } | Status 200 OK
| |
19 | |||
|
---|
Post – conditions:
|
OpenLMIS: the global initiative for powerful LMIS software