1077: Associate emergency requisitions with a processing period

Test Case #:1077


Test Case Name: Associate emergency requisitions with a processing period

System: openLMIS

Subsystem: blue

Test case designed by: Lucyna Laska

Design Date:14.11.2016

Short description

API:

Acceptance Criteria

  • The Requisitions service API supports initiating an emergency requisition associated with a processing period.
  • Emergency requisitions still enforce the same permissions checks about facility and user role as regular requisitions.
  • Each processing period can have multiple emergency requisitions (zero, one or multiple).

UI:

  • The UI allows authorized users to initiate and fill out one or more emergency requisitions for their authorized facilities/programs.
  • Each emergency requisition is associated with a processing period.
  • A processing period can have multiple emergency requisitions (see screenshot on the parent ticket for how the UI looks).

                                                                                                                                                   

Pre – conditions:

                                                                                                                                                                                                                                                       



Step

Action

Expected system response

Comment


TEST CASES FOR TESTING USING API

1

    Find if it's possible to create an emergency requisition for:

  • programID = 10845cb9-d365-4aaa-badd-b4fa39c6a26a,
  •  facilityID=e6799d64-d10d-4011-b8c2-0e4d4a3f65ce 
  • emergency = true

     URL:   http://192.168.1.14/requisition/api/requisitions/periodsForInitiate?programId=10845cb9-d365-4aaa-badd-b4fa39c6a26a&facilityId=e6799d64-d10d-4011-b8c2-0e4d4a3f65ce&emergency=true&access_token=0a211aa5-2864-4e00-be33-afa8cc70111c  

Method: GET

          Yes, it's possible. It's only one created period that can be included during creating the emergency requisition.                                                                        

                                                 

2

Initiate an emergency requisition when user has assigned proper role.

URL:  http://192.168.1.14/requisition/api/requisitions/initiate?program=10845cb9-d365-4aaa-badd-b4fa39c6a26a&facility=e6799d64-d10d-4011-b8c2-0e4d4a3f65ce&suggestedPeriod=7880be4f-6582-472a-9ea5-a6baed71e6e5&emergency=true&access_token=0a211aa5-2864-4e00-be33-afa8cc70111c

Method: POST


Requisition has been initiated successfully.


3

 Initiate an emergency requisition when user does not have assigned proper role.

URL:  http://192.168.1.14/requisition/api/requisitions/initiate?program=10845cb9-d365-4aaa-badd-b4fa39c6a26a&facility=e6799d64-d10d-4011-b8c2-0e4d4a3f65ce&suggestedPeriod=7880be4f-6582-472a-9ea5-a6baed71e6e5&emergency=true&access_token=0a211aa5-2864-4e00-be33-afa8cc70111c
Method: POST



Without assigned proper role, user can't initiate requisition.

to update the user roles:

URL:  http://192.168.1.14/referencedata/api/users?access_token=0a211aa5-2864-4e00-be33-afa8cc70111c

Method: PUT

Body:

 {
         "id": "a337ec45-31a0-4f2b-9b2e-a105c4b669bb",
    "username": "administrator",
    "firstName": "Admin",
    "lastName": "Admin",
    "email": "administrator@openlmis.org",
    "timezone": "CET",
    "homeFacility": {
      "code": "HC01",
      "name": "Comfort Health Clinic",
      "geographicZone": {
        "code": "M-So-Bal-Bal",
        "name": "Balaka",
        "level": {
          "code": "City",
          "levelNumber": 4,
          "id": "90e35999-a64f-4312-ba8f-bc13a1311c75"
        },
        "latitude": -14.99,
        "longitude": 34.92,
        "id": "bf2b810b-cdbf-48b2-b569-149b3cf42387"
      },
      "type": {
        "code": "HC",
        "name": "Health Center",
        "displayOrder": 1,
        "active": true,
        "id": "ac1d268b-ce10-455f-bf87-9c667da8f060"
      },
      "operator": {
        "code": "moh",
        "name": "Ministry of Health",
        "displayOrder": 1,
        "id": "9456c3e9-c4a6-4a28-9e08-47ceb16a4121"
      },
      "active": true,
      "enabled": true,
      "openLmisAccessible": true,
      "supportedPrograms": [
        {
          "code": "PRG001",
          "name": "Family Planing",
          "active": true,
          "periodsSkippable": true,
          "id": "dce17f2e-af3e-40ad-8e00-3496adef44c3"
        },
        {
          "code": "PRG002",
          "name": "Essential Meds",
          "active": true,
          "periodsSkippable": false,
          "id": "10845cb9-d365-4aaa-badd-b4fa39c6a26a"
        }
      ],
      "id": "e6799d64-d10d-4011-b8c2-0e4d4a3f65ce"
    },
    "verified": true,
    "active": true,
    "loginRestricted": false,
    "roleAssignments": []

  }

4

Try to initiate an emergency requisition with wrong period.

URL:  http://192.168.1.14/requisition/api/requisitions/initiate?program=10845cb9-d365-4aaa-badd-b4fa39c6a26a&facility=e6799d64-d10d-4011-b8c2-0e4d4a3f65ce&suggestedPeriod=f419bcd8-ac7a-4b75-8c84-c065ef437938&emergency=true&access_token=0a211aa5-2864-4e00-be33-afa8cc70111c

Method: POST

It's not possible to initiate requisition when suggested period is incorrect.



5

List all emergency requisitions.

URL:  http://192.168.1.14/requisition/api/requisitions/search?emergency=true&access_token=0a211aa5-2864-4e00-be33-afa8cc70111c

Method: GET


All emergency requisitions can be displayed by using the 'emergency' parameter in request.

6

Try to initiate a few emergency requisitions for the same period.

URL:  http://192.168.1.14/requisition/api/requisitions/initiate?program=10845cb9-d365-4aaa-badd-b4fa39c6a26a&facility=e6799d64-d10d-4011-b8c2-0e4d4a3f65ce&suggestedPeriod=7880be4f-6582-472a-9ea5-a6baed71e6e5&emergency=true&access_token=adfb41e2-dec6-4905-84cb-bba57e957000

Method: POST

The another emergency requisition has been created properly (parameters are still the same as the situation discribed in point 3).


7


The emergency requisition has been successfully deleted.


8

   Check if deleted emergency requisition is no longer available.                       

status 404 not found is returned. Deleted requisition is not available.




9

Try to submit the emergency requisition.

URL:  http://10.222.17.134/requisition/api/requisitions/bc4dac0b-6cd7-4ff4-8c1d-8f20c54590a6/submit?access_token=64bbdeb1-49d4-4e03-8a05-90ddf457a5ba

Method: POST

Emergency requisition has been successfully submitted.


10

Try to authorize the emergency requisition.

URL:  http://10.222.17.134/requisition/api/requisitions/bc4dac0b-6cd7-4ff4-8c1d-8f20c54590a6/authorize?access_token=64bbdeb1-49d4-4e03-8a05-90ddf457a5ba

Method: POST

Emergency requisition has been successfully authorized.



11

Try to approve the emergency requisition.

URL:  http://10.222.17.134/requisition/api/requisitions/bc4dac0b-6cd7-4ff4-8c1d-8f20c54590a6/approve?access_token=64bbdeb1-49d4-4e03-8a05-90ddf457a5ba

Method: POST

Emergency requisition has been successfully approved.



TESTING PROCESS USING UI.



1Log in to main UI.

User should be logged in.


2Find the emergency requisitions for proper facility and program.

The list of emergency requisitions is displayed. Currently, emergency requisitions is not initiated. After clicking the PROCEED button, emergency requisition will be initiated.


3

Try to submit the emergency requisition.

The emergency requisition has been successfully submitted.


The status of emergency requisitions is changed.

4Try to authorize the emergency requisition.

The emergency requisition has been successfully authorized.


5Go back to the view with all emergency requisitions for the same facility and program as above.

The list with all emergency requisitions is available.



6Try to initiate a new emergency requisition.

Emergency requisition has status: Not yet started. It means that emergency requisition is not initiated yet. User can initiate a new emergency requisition once previous one is authorized (I'm allowed to, since my previous one is waiting for approval). When user selects the PROCESS button, emergency requisition will be initiated.



7Go back to the view with requisitions ready for approve.

The list with all emergency requisitions is displayed.



8Reject the emergency requisition.

The emergency requisition has been successfully rejected.



9Go back to the view with all emergency requisition for the same facility and program as earlier.

Two requisitions with status INITIATED are visible. User can act upon both of them (the one that came back because of being rejected and the new one, that I've initiated, because I was allowed to).




Post – conditions:

OpenLMIS: the global initiative for powerful LMIS software