Commit 8889364f authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

feat: align attributes updates operations on v1.6

- improve doc for partial attribute update
- add a permutation to check an attribute type can be changed in update attributes
parent f3169554
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that one cannot perform a partial update on an entity attribute with invalid/missing ids
Documentation       Check that one cannot perform a partial update on an entity attribute with invalid data

Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
Resource            ${EXECDIR}/resources/AssertionUtils.resource
@@ -18,18 +18,22 @@ ${status_code}= 400

*** Test Cases ***    ENTITY_ID    ATTRIBUTE_ID    FRAGMENT_FILENAME
012_02_01 Make a partial attribute update if the Entity Id is not present
    [Documentation]    Check that one cannot perform a partial update on an entity attribute with missing entity id
    ${EMPTY}    speed    vehicle-speed-equal-datasetid-fragment.jsonld
012_02_02 Make a partial attribute update if the Entity Id is not a valid URI
    [Documentation]    Check that one cannot perform a partial update on an entity attribute with invalid entity id
    thisisaninvaliduri    speed    vehicle-speed-equal-datasetid-fragment.jsonld
012_02_03 Make a partial attribute update if the Attribute type does not match
    [Documentation]    Check that one cannot perform a partial update on an entity attribute with a different attribute type
    ${valid_entity_id}    speed    vehicle-speed-equal-datasetid-different-type-fragment.jsonld
012_02_04 Make a partial attribute update if the entity fragment is empty
    [Documentation]    Check that one cannot perform a partial update on an entity attribute with an empty fragment
    ${valid_entity_id}    speed    empty-fragment.json


*** Keywords ***
Update Attributes
    [Documentation]    Check that one cannot perform a partial update on an entity attribute with invalid/missing ids
    [Documentation]    Check that one cannot perform a partial update on an entity attribute in some conditions
    [Tags]    ea-partial-update    5_6_4
    [Arguments]    ${entity_id}    ${attribute_id}    ${fragment_filename}
    ${response}=    Partial Update Entity Attributes
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ ${filename}= vehicle-two-datasetid-attributes.jsonld
    204    vehicle-speed-two-datasetid-02-fragment.jsonld    expectations/vehicle-update-datasetid-attributes.jsonld
011_01_03 Check that one can update existing attributes and append non-existing attributes
    204    vehicle-speed-two-datasetid-03-fragment.jsonld    expectations/vehicle-multi-attributes.jsonld
011_01_04 Check that one can change the type of an existing attribute
    204    vehicle-speed-two-datasetid-04-fragment.jsonld    expectations/vehicle-update-attributes-new-attribute-type.jsonld


*** Keywords ***
+38 −0
Original line number Diff line number Diff line
{
  "id": "urn:ngsi-ld:Vehicle:7622668541444466",
  "type": "Vehicle",
  "speed": [
    {
      "type": "Property",
      "value": 54.5,
      "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed",
      "source": {
        "type": "Property",
        "value": "GPS"
      }
    },
    {
      "type": "Property",
      "value": 55,
      "source": {
        "type": "Property",
        "value": "Speedometer"
      }
    }
  ],
  "brandName": {
    "type": "Relationship",
    "object": "urn:ngsi-ld:Brand:01"
  },
  "isParked": {
    "type": "Relationship",
    "datasetId": "urn:ngsi-ld:Relationship:parked12345",
    "object": "urn:ngsi-ld:OffStreetParking:Downtown1",
    "observedAt": "2017-07-29T12:00:04Z",
    "providedBy": {
      "type": "Relationship",
      "object": "urn:ngsi-ld:Person:Bob"
    }
  },
  "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld"
}
 No newline at end of file
+9 −0
Original line number Diff line number Diff line
{
    "brandName": {
        "type": "Relationship",
        "object": "urn:ngsi-ld:Brand:01"
    }, 
    "@context": [
      "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld"
    ]
}
 No newline at end of file
+16 −0
Original line number Diff line number Diff line
@@ -63,6 +63,22 @@
      "when": "when {\n    the SUT receives a Request from the client containing:\n        URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n        method set to 'PATCH'\n        Update Entity Attributes and\n    Query Parameter: id set to '${entity_id}' and\n    Query Parameter: fragment_filename set to 'vehicle-speed-two-datasetid-03-fragment.jsonld' and\n    Query Parameter: content_type set to 'application/ld+json'\n}",
      "http_verb": "PATCH",
      "endpoint": "entities/{entityId}/attrs/{attributeId}"
    },
    {
      "name": "011_01_04 Check that one can change the type of an existing attribute",
      "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_01_04",
      "doc": "Check that one can update entity attributes",
      "tags": [
        "ea-update",
        "5_6_2"
      ],
      "setup": "Initialize Test",
      "teardown": "Delete Initial Entities",
      "template": "Update Attributes",
      "then": "then {\n    the SUT sends a valid Response for the operations:\n        Update Entity Attributes with Response Status Code set to 204     and\n        Retrieve Entity by Id with Check Updated Entity and\n            Query Parameter: 'updated_resource' set to 'entity_expectation_payload' and\n            Query Parameter: 'response_body' set to 'response1.json()' and\n            Query Parameter: 'ignored_keys' set to 'ignored_attributes'\n}",
      "when": "when {\n    the SUT receives a Request from the client containing:\n        URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n        method set to 'PATCH'\n        Update Entity Attributes and\n    Query Parameter: id set to '${entity_id}' and\n    Query Parameter: fragment_filename set to 'vehicle-speed-two-datasetid-04-fragment.jsonld' and\n    Query Parameter: content_type set to 'application/ld+json'\n}",
      "http_verb": "PATCH",
      "endpoint": "entities/{entityId}/attrs/{attributeId}"
    }
  ],
  "permutations": [
Loading