044_01.robot 2.22 KB
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

*** Variable ***
${vehicle_id_prefix}=  urn:ngsi-ld:Vehicle:
${vehicle_filename}=  vehicle-simple-attributes-sample.jsonld
lopesg's avatar
lopesg committed
${vehicle_fragment}=  vehicle-brandname-fragment.json
lopesg's avatar
lopesg committed
${attribute_id}=  brandName

${subscription_id_prefix}=  urn:ngsi-ld:Subscription:
lopesg's avatar
lopesg committed
${subscription_filename}=  subscriptions/subscription-sample.jsonld
${subscription_fragment}=  subscriptions/fragments/subscription-update-sample.json
lopesg's avatar
lopesg committed

lopesg's avatar
lopesg committed
*** Test Cases ***                      
044_01_01_endpoint /entities/{entityId}/attrs/{attrId}
lopesg's avatar
lopesg committed
    [Documentation]  Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type 
    [Tags]  mandatory
    ${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}
lopesg's avatar
lopesg committed
    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}       
lopesg's avatar
lopesg committed
    [Documentation]  Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type 
    [Tags]  mandatory
    ${subscription_id}=       Generate Random Entity Id    ${subscription_id_prefix}    
    ${response}=    Create Subscription    ${subscription_id}    ${subscription_filename}    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code  201    ${response['status']}

lopesg's avatar
lopesg committed
    ${response}=    Update Subscription    ${subscription_id}     ${subscription_fragment}    ${CONTENT_TYPE_MERGE_PATCH_JSON}    context=${ngsild_test_suite_context}
lopesg's avatar
lopesg committed
    Check Response Status Code  204    ${response['status']}

    [Teardown]  Delete Subscription  ${subscription_id}