1074: Saving with attached rights does not actually save

Test Case #:1074

Test Case Name:Saving with attached rights does not actually save

System: OpenLMIS

Subsystem: blue

Test case designed by: Paulina Borowa

Design Date:16.11.2016

Short description

When trying to save a right with attached rights, it does not actually attach the rights to each other. Need to fix this in order to support attached rights.

This is for the API endpoint PUT /rights and the "attachments" parameter.

Acceptance Criteria

  • You can hit the API to put a right with zero attachments, and that should work (for users who are authorized to create rights).
  • You can GET and PUT at /rights and GET and DELETE at /rights/ {rightId}

    and all of those API calls should work with zero, one or multiple attached rights.

                                                                                                                                                   

Pre – conditions:

demo-data                                                                                                                                                                                                                                                      

Step

Action

Expected system response

Comment

1

Create new rights:

  • with one attached rights:

In URL: 10.222.17.205//referencedata/api/rights?access_token=25fc6032-7a16-474e-a55b-7d9b5e182854

Method PUT

Body:

{

  "name": "test",

  "type": "SUPERVISION",

  "attachments": [

      {

    "id": "e101d2b8-6a0f-4af6-a5de-a9576b4ebc50",

    "name": "REQUISITION_VIEW",

    "type": "SUPERVISION",

    "attachments": []

  }

      ]

}

  •  with zero attached rights:

{

  "name": "test",

  "type": "SUPERVISION",

  "attachments": []

}


                                                                                                   

with one or multiple attached rights:

                                                                   with zero attached rights:

                                                 

2

Check if previously created rights was correctly saved

  In URL: 10.222.17.205/referencedata/api/rights/?access_token=25fc6032-7a16-474e-a55b-7d9b5e182854

Method GET

also

In URL: 10.222.17.205/referencedata/api/rights/1e723346-8a8b-4f0f-bcf0-8ecb48244308?access_token=25fc6032-7a16-474e-a55b-7d9b5e182854

Method GET

 




3

Delete previously created rights

In URL:

10.222.17.205/referencedata/api/rights/1e723346-8a8b-4f0f-bcf0-8ecb48244308?access_token=25fc6032-7a16-474e-a55b-7d9b5e182854

Method DELETE

 


4

Check if rights with ID:  1e723346-8a8b-4f0f-bcf0-8ecb48244308 was removed

In URL: 10.222.17.205/referencedata/api/rights/?access_token=25fc6032-7a16-474e-a55b-7d9b5e182854

Method GET

also

In URL: 10.222.17.205/referencedata/api/rights/1e723346-8a8b-4f0f-bcf0-8ecb48244308?access_token=25fc6032-7a16-474e-a55b-7d9b5e182854

Method GET

 


5

Create rights with multiple attached rights

In URL:

10.222.17.205/referencedata/api/rights/?access_token=25fc6032-7a16-474e-a55b-7d9b5e182854

Method PUT

Body:

{

  "name": "TEST_RIGHTS",

  "type": "SUPERVISION",

  "attachments": [

    {

      "id": "e101d2b8-6a0f-4af6-a5de-a9576b4ebc50",

      "name": "REQUISITION_VIEW",

      "type": "SUPERVISION",

      "attachments": []

    },

    {

      "id": "9ade922b-3523-4582-bef4-a47701f7df14",

      "name": "REQUISITION_CREATE",

      "type": "SUPERVISION",

      "attachments": []

    },

    {

      "id": "c3eb5df0-c3ac-4e70-a978-02827462f60e",

      "name": "REQUISITION_DELETE",

      "type": "SUPERVISION",

      "attachments": []

    },

    {

      "id": "bffa2de2-dc2a-47dd-b126-6501748ac3fc",

      "name": "REQUISITION_APPROVE",

      "type": "SUPERVISION",

      "attachments": []

    }

  ]

}

 


6

Check if previously created rights was correctly saved

  In URL: 10.222.17.205/referencedata/api/rights/?access_token=25fc6032-7a16-474e-a55b-7d9b5e182854

Method GET

also

In URL: 10.222.17.205/referencedata/api/rights/ae0151b1-9161-49bb-a781-912e02e30ab2?access_token=25fc6032-7a16-474e-a55b-7d9b5e182854

Method GET



7

Delete previously created rights

In URL:

10.222.17.205/referencedata/api/rights/ae0151b1-9161-49bb-a781-912e02e30ab2?access_token=25fc6032-7a16-474e-a55b-7d9b5e182854

Method DELETE


8

Check if rights with ID:ae0151b1-9161-49bb-a781-912e02e30ab2 was removed

In URL: 10.222.17.205/referencedata/api/rights/ae0151b1-9161-49bb-a781-912e02e30ab2?access_token=25fc6032-7a16-474e-a55b-7d9b5e182854
Method DELETE


9

Update a right
In URL: 10.222.17.205/referencedata/api/rights/?access_token=25fc6032-7a16-474e-a55b-7d9b5e182854

Method PUT

Body:

 {

    "id": "feb4c0b8-f6d2-4289-b29d-811c1d0b2863",

    "name": "REQUISITION_AUTHORIZE",

    "type": "SUPERVISION",

    "attachments": []

  }

Before update:

After uptade:



Check:

attached rights must of the same right type as the one being attached to


In URL: 10.222.17.205/referencedata/api/rights?access_token=06c8c453-75c2-416f-b3f3-57d4ba8edd6d

Method PUT

Body

{

    "id": "fb6a0053-6254-4b41-8028-bf91421f90dd",

    "name": "MANAGE_PRODUCT",

    "type": "GENERAL_ADMIN",

    "attachments": [

        {

    "id": "9ade922b-3523-4582-bef4-a47701f7df14",

    "name": "REQUISITION_CREATE",

    "type": "SUPERVISION",

    "attachments": []

  },

  {

    "id": "5c4b3b9b-713e-4b9a-8c58-7efcd2954512",

    "name": "MANAGE_SUPERVISORY_NODE",

    "type": "GENERAL_ADMIN",

    "attachments": []

  }]

  }


It takes only rights with same right type as the one being attached to:

for sure check by GET


OpenLMIS: the global initiative for powerful LMIS software