1101: OOAD Refactor: Submitting a requisition needs more validations

Test Case #:1101


Test Case Name: OOAD Refactor: Submitting a requisition needs more validations

System: openLMIS

Subsystem: blue

Test case designed by: Lucyna Laska

Design Date:16.12.2016

Short description

This endpoint starts by taking as input both a requisition object, and a requisition ID. The Requisition object passed in is never verified to be the one stored. So we need to add that verification, and write an automated test to show that passing in bad data. Validation checks for ensuring we don’t change the requisition’s facility, processing period, program, etc appear to be missing. The domain object should enforce that these are immutable after creation. Trying to change these should return an error.

                                                                                                                                                   

Pre – conditions:

                                                                                                                                                                                                                                                       



Step

Action

Expected system response

Comment

1

 Initiate the requisition. 

  URL:  http://10.222.17.134/api/requisitions/initiate?program=10845cb9-d365-4aaa-badd-b4fa39c6a26a&facility=e6799d64-d10d-4011-b8c2-0e4d4a3f65ce&emergency=false&access_token=e99af997-8cff-4fa9-a20f-0c9f7d231eb8

Method: POST


                                                               

The requisition has been successfully initiated.

                                                             

                                                 

2

 Try to update the requisition and change the:

  • processingPeriod
  • program
  • facility
  • emergency status


URL:  http://10.222.17.134/api/requisitions/4360fbe5-d625-4793-a13e-024114a07e2a?access_token=e99af997-8cff-4fa9-a20f-0c9f7d231eb8

Method: PUT

Body:

{

  "id": "4360fbe5-d625-4793-a13e-024114a07e2a",

  "createdDate": [

    2016,

    12,

    16,

    12,

    3,

    23,

    937000000

  ],

  "requisitionLineItems": [

    {

      "id": "7c2e9604-eb25-4817-a1ce-9f9ac59c07ec",

      "orderableProduct": {

        "id": "2400e410-b8dd-4954-b1c0-80d8a8e785fc",

        "productCode": "C1",

        "name": "Acetylsalicylic Acid",

        "packSize": 16,

        "packRoundingThreshold": 8,

        "roundToZero": false,

        "programs": [

          {

            "programId": "10845cb9-d365-4aaa-badd-b4fa39c6a26a",

            "productId": "2400e410-b8dd-4954-b1c0-80d8a8e785fc",

            "productCategoryId": "6805dd74-ec00-4697-9a5d-5b78414fcaf6",

            "productCategoryDisplayName": "Antibiotics",

            "productCategoryDisplayOrder": 1,

            "active": true,

            "fullSupply": true,

            "displayOrder": 1,

            "maxMonthsOfStock": 1000,

            "dosesPerMonth": 10,

            "pricePerPack": "3.16"

          }

        ],

        "dispensable": {

          "dispensingUnit": "10 tab strip"

        }

      },

      "beginningBalance": 0,

      "totalReceivedQuantity": 0,

      "totalLossesAndAdjustments": 0,

      "stockOnHand": 0,

      "requestedQuantity": null,

      "totalConsumedQuantity": null,

      "requestedQuantityExplanation": null,

      "remarks": null,

      "approvedQuantity": null,

      "totalStockoutDays": null,

      "total": 0,

      "packsToShip": null,

      "pricePerPack": "3.16",

      "stockAdjustments": []

    },

    {

      "id": "ddd23b40-5a38-45ee-a8a3-339bb43a1f88",

      "orderableProduct": {

        "id": "c9e65f02-f84f-4ba2-85f7-e2cb6f0989af",

        "productCode": "C4",

        "name": "Streptococcus Pneumoniae Vaccine II",

        "packSize": 5,

        "packRoundingThreshold": 2,

        "roundToZero": false,

        "programs": [

          {

            "programId": "10845cb9-d365-4aaa-badd-b4fa39c6a26a",

            "productId": "c9e65f02-f84f-4ba2-85f7-e2cb6f0989af",

            "productCategoryId": "16173fd0-f439-4222-931e-91c413a495c3",

            "productCategoryDisplayName": "Vaccines",

            "productCategoryDisplayOrder": 5,

            "active": true,

            "fullSupply": true,

            "displayOrder": 4,

            "maxMonthsOfStock": 30,

            "dosesPerMonth": 1,

            "pricePerPack": "4.13"

          }

        ],

        "dispensable": {

          "dispensingUnit": "each"

        }

      },

      "beginningBalance": 0,

      "totalReceivedQuantity": 0,

      "totalLossesAndAdjustments": 0,

      "stockOnHand": 0,

      "requestedQuantity": null,

      "totalConsumedQuantity": null,

      "requestedQuantityExplanation": null,

      "remarks": null,

      "approvedQuantity": null,

      "totalStockoutDays": null,

      "total": 0,

      "packsToShip": null,

      "pricePerPack": "4.13",

      "stockAdjustments": []

    }

  ],

  "comments": [],

  "facility": {

          "id": "ab95f1cf-ae8d-4888-ba9d-05141d3f50de",

        "code": "FAC004",

    "name": "Facility Inactive Disabled",

    "geographicZone": {

      "code": "Mal-So",

      "name": "Southern Region",

      "level": {

        "code": "Region",

        "levelNumber": 2,

        "id": "9b497d87-cdd9-400e-bb04-fae0bf6a9491"

      },

      "id": "0bbd69c1-e20f-48f5-aae4-26dcd8aa7602"

    },

    "type": {

      "code": "DH",

      "name": "District Hospital",

      "displayOrder": 2,

      "active": true,

      "id": "663b1d34-cc17-4d60-9619-e553e45aa441"

    },

    "operator": {

      "code": "dwb",

      "name": "Doctors without Borders",

      "displayOrder": 2,

      "id": "1074353d-7364-4618-a127-708d7303a231"

    },

    "active": false,

    "enabled": false,

    "openLmisAccessible": true,

    "supportedPrograms": []


  },

  "program": {

   "id": "dce17f2e-af3e-40ad-8e00-3496adef44c3",

    "code": "PRG001",

    "name": "Family Planing",

    "description": null,

    "active": true,

    "periodsSkippable": true,

    "showNonFullSupplyTab": true

  },

  "processingPeriod": {

    "id": "7880be4f-6582-472a-9ea5-a6baed71e6e5",

    "processingSchedule": {

  "id": "057921bd-1841-4748-8523-dbe5ebb58368",

      "code": "SCH002",

      "description": null,

      "modifiedDate": null,

      "name": "Quarterly"

    },

    "name": "Q4",

    "startDate": [

      2016,

      10,

      1

    ],

    "endDate": [

      2016,

      12,

      31

    ]

  },

  "status": "INITIATED",

  "emergency": true,

  "supplyingFacility": null,

  "supervisoryNode": null

}




The updating the parameters: processingPeriod, program, facility, emergency status is not possible. Proper error message is displayed.


3




4




5




6




7




8

                                                




Post – conditions:

OpenLMIS: the global initiative for powerful LMIS software