Skip to content
044_01.robot 2.25 KiB
Newer Older
lopesg's avatar
lopesg committed
*** Settings ***
Documentation     Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type
Resource          ${EXECDIR}/resources/ApiUtils.resource
Resource          ${EXECDIR}/resources/AssertionUtils.resource
Resource          ${EXECDIR}/resources/JsonUtils.resource
lopesg's avatar
lopesg committed

*** Variable ***
${vehicle_id_prefix}=    urn:ngsi-ld:Vehicle:
${vehicle_filename}=    vehicle-simple-attributes-sample.jsonld
${vehicle_fragment}=    vehicle-brandname-fragment.json
${attribute_id}=    brandName
${subscription_id_prefix}=    urn:ngsi-ld:Subscription:
${subscription_filename}=    subscriptions/subscription-sample.jsonld
${subscription_fragment}=    subscriptions/fragments/subscription-update-sample.json

*** Test Cases ***
044_01_01_endpoint /entities/{entityId}/attrs/{attrId}
    [Documentation]    Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type
    [Tags]    ea-partial-update    6_3_4
    ${entity_id}=    Generate Random Entity Id    ${vehicle_id_prefix}
    ${request}    ${response}=    Create Entity Selecting Content Type    ${vehicle_filename}    ${entity_id}    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${response['status']}
lopesg's avatar
lopesg committed
    ${response}=    Partial Update Entity Attributes    ${entity_id}    ${attribute_id}    ${vehicle_fragment}    ${CONTENT_TYPE_MERGE_PATCH_JSON}    context=${ngsild_test_suite_context}
    Check Response Status Code    204    ${response['status']}
    [Teardown]    Delete Entity by Id    ${entity_id}
lopesg's avatar
lopesg committed

044_01_02_endpoint /subscriptions/{subscriptionId}
    [Documentation]    Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type
    [Tags]    sub-update    6_3_4
    ${subscription_id}=    Generate Random Entity Id    ${subscription_id_prefix}
lopesg's avatar
lopesg committed
    ${response}=    Create Subscription    ${subscription_id}    ${subscription_filename}    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${response['status']}
    ${response}=    Update Subscription    ${subscription_id}    ${subscription_fragment}    ${CONTENT_TYPE_MERGE_PATCH_JSON}    context=${ngsild_test_suite_context}
    Check Response Status Code    204    ${response['status']}
    [Teardown]    Delete Subscription    ${subscription_id}