OLMIS-755 : Define periods within a schedule.

Test Case #:755

Test Case Name: Define periods within a schedule.

System: OpenLMIS

Subsystem:Requisition

Test case designed by: Piotr Żurawski

Design Date:25.07.2016

Short description: Check possibility to Define periods within a schedule

                                                                                                                                                   

Pre – conditions:

Create schedule:

URL:  http://localhost:8080/api/schedules

Method: POST

Body:
{
"code":"schedule_Code",
"name":"schedule_Name"
}

                                                                                                                                                                                                      

 

 

Step

Action

Expected system response

Comment

1

Create Period:

URL: http://localhost:8080/api/periods

Method: POST

Body:

{ "processingSchedule": { "id":"Here should be paste href created in schedules", "code" : "codecodee", "description" : "description", "modifiedDate" : "2016-07-11T11:24:38.515", "name" : "scheduleNamee" }, "name" : "periodName", "description" : "periodDescription", "startDate" : "2016-07-11", "endDate" : "2016-07-12" }

{ "id": "3da23278-d288-4686-95b1-0aa1d1ed6d38", "processingSchedule": { "id": "98b08104-3d1e-43f1-9872-ae23f91a3010", "code": "schedule_Code", "description": null, "modifiedDate": "2016-07-25T08:17:50.077", "name": "schedule_Name" }, "name": "periodName", "description": "periodDescription", "startDate": "2016-07-11", "endDate": "2016-07-12" }

 

2

Try to create Period using start date as end date used in first step + 2 days:

URL: http://localhost:8080/api/periods

Method: POST

Body:

{ "processingSchedule": { "id":"98b08104-3d1e-43f1-9872-ae23f91a3010", "code": "schedule_Code", "description": null, "modifiedDate": "2016-07-25T08:17:50.077", "name": "schedule_Name" }, "name" : "periodName", "description" : "periodDescription", "startDate" : "2016-07-14", "endDate" : "2016-07-15" }

{ "startDate": "Start date should be one day after last added end date" }

 

3

Try to create Period using start date as end date used in first step + 1 day:

URL: http://localhost:8080/api/periods

Method: POST

Body: {

"processingSchedule": { "id":"98b08104-3d1e-43f1-9872-ae23f91a3010", "code": "schedule_Code", "description": null, "modifiedDate": "2016-07-25T08:17:50.077", "name": "schedule_Name" }, "name" : "periodName", "description" : "periodDescription", "startDate" : "2016-07-13", "endDate" : "2016-07-14" }

{ "id": "7173b3f0-cc3b-4d3b-bb56-b3525102b037", "processingSchedule": { "id": "98b08104-3d1e-43f1-9872-ae23f91a3010", "code": "schedule_Code", "description": null, "modifiedDate": "2016-07-25T08:17:50.077", "name": "schedule_Name" }, "name": "periodName", "description": "periodDescription", "startDate": "2016-07-13", "endDate": "2016-07-14" } 
4

Check if the system calculates and displays the total days and months:

URL: http://localhost:8080/api/periods/{here_period_UUID_created_before}/difference

Method: GET

E.g. : http://localhost:8080/api/periods/7173b3f0-cc3b-4d3b-bb56-b3525102b037/difference

"Period lasts 0 months and 2 days" 

Post – conditions:

OpenLMIS: the global initiative for powerful LMIS software