805: Ability to download a CSV file of the order

 Test Case #:805

Test Case Name: Ability to download a CSV file of the order

System: OpenLMIS

Subsystem: requisition

Test case designed by: Paulina Borowa

Design Date:22.07.2016

Short description: It should be possible to generate a CSV file from the Order instance. Since configuring order file is not yet possible, we should assume a default set of columns (we can look at v2 for the list of desired columns). Generic solution is out of scope for now.

                                                                                                                                                   

Pre – conditions:

1.


 Step

Action

Expected system response

Comment

1

                                                                            

Create User entity.

In URL: http://localhost:8080/api/users

Method: Post:

Body:

{

"username":"Name1",

"firstName":"FName1",

"lastName":"Lname1",

"active":"true",

"verified":"false"

}

                                                                                          

                                                         Status 201 created, 

                                                                  User id: "http://localhost:8080/api/users/b9a5c8cd-eb01-4f4b-9cfe-c9c931a60c3b"

                                                 

2

Create Program entity.

In URL: http://localhost:8080/api/programs

Method: Post:

Body:

{

"code":"kod2",

"showNonFullSupplyTab":true,

"skippable":false

}

 
 Status 201 created, 

                                                                Program id: "http://localhost:8080/api/programs/79089792-2514-4715-9711-c246a8d1ab64"

 

3

Create ProductCategory entity.

In URL: http://localhost:8080/api/productCategories

Method: Post:

Body:

{

"code":"ProdCat",

"name":"Produkt",

"displayOrder":"2"

}

 

 Status 201 created,

ProductCategory id: "http://localhost:8080/api/productCategories/dcddca24-0180-4ff9-adcc-2156c27ffc73"

 

4

Create Product entity.

In URL: http://localhost:8080/api/productss

Method: Post:

Body:

{

"code":"code2",

"primaryName":"Product",

"dispensingUnit":"unit",

"dosesPerDispensingUnit":"10",

"packSize":"1",

"packRoundingThreshold":"0",

"roundToZero":false,

"active":true,

"fullSupply":true,

"tracer":false,

"productCategory":"http://localhost:8080/api/productCategories/dcddca24-0180-4ff9-adcc-2156c27ffc73"

}

 
Status 201 created, 

Product id: http://localhost:8080/api/products/d385cfbd-d63f-49ee-aacc-8b9ac8107e25"

 

5

Create Order entity.

In URL: http://localhost:8080/api/orders

Method: Post:

Body:

{

"createdBy":"http://localhost:8080/api/users/b9a5c8cd-eb01-4f4b-9cfe-c9c931a60c3b",

"program":"http://localhost:8080/api/programs/79089792-2514-4715-9711-c246a8d1ab64",

"orderCode":"2",

"requestingFacility":"http://localhost:8080/api/facilities/fdddb637-cf1d-4355-b839-ca2c2dba3977",

"receivingFacility":"http://localhost:8080/api/facilities/b45aea73-d9ef-42d2-8caa-ba33e0aec724",

"supplyingFacility":"http://localhost:8080/api/facilities/20175b9b-7dd2-427d-9ad0-d273807dfbc0",

"status":"PICKING",

"quotedCost":"3"

 

}

 

Status 201 created,

Order id: "http://localhost:8080/api/orders/6611b2d8-c205-44ee-a42a-86c50397cc15"

 
 

6

Create a few orderLines entity with different orderedQuantity values.

In URL: http://localhost:8080/api/orderLines

Method: Post:

Body:

{

"order":"http://localhost:8080/api/orders/6611b2d8-c205-44ee-a42a-86c50397cc15",

"product":"http://localhost:8080/api/products/d385cfbd-d63f-49ee-aacc-8b9ac8107e25",

"orderedQuantity":"2"

}

In URL: http://localhost:8080/api/orderLines

Method: Post:

Body:

{

"order":"http://localhost:8080/api/orders/6611b2d8-c205-44ee-a42a-86c50397cc15",

"product":"http://localhost:8080/api/products/d385cfbd-d63f-49ee-aacc-8b9ac8107e25",

"orderedQuantity":"3"

}

 

In URL: http://localhost:8080/api/orderLines

Method: Post:

Body:

{

"order":"http://localhost:8080/api/orders/6611b2d8-c205-44ee-a42a-86c50397cc15",

"product":"http://localhost:8080/api/products/d385cfbd-d63f-49ee-aacc-8b9ac8107e25",

"orderedQuantity":"6"

}

Status 201 Created,

Status 201 Created,

Status 201 Created,

 

7

 

Check if the generated CSV file is suitable

In URL: http://localhost:8080/api/orders/csv/6611b2d8-c205-44ee-a42a-86c50397cc15

Method: Get

Status 200 OK

 

 

8

                          

Create another orderLine enity.

In URL: http://localhost:8080/api/orderLines

Method: Post:

Body:

{

"order":"http://localhost:8080/api/orders/6611b2d8-c205-44ee-a42a-86c50397cc15",

"product":"http://localhost:8080/api/products/d385cfbd-d63f-49ee-aacc-8b9ac8107e25",

"orderedQuantity":"12"

}

 

 

Status 201 Created

 

 

 

9Check if it’s added to previously created CSV file                  

In URL: http://localhost:8080/api/orders/csv/6611b2d8-c205-44ee-a42a-86c50397cc15

Method: Get

Status 200 OK

 

 

OpenLMIS: the global initiative for powerful LMIS software