Skip to content
038_01.robot 1.84 KiB
Newer Older
Documentation     Check that you can create a minimal context source registration subscription
Resource          ${EXECDIR}/resources/ApiUtils.resource
Resource          ${EXECDIR}/resources/AssertionUtils.resource
Resource          ${EXECDIR}/resources/JsonUtils.resource
Suite Setup       Generate Random Ids For Context Source Registration Subscriptions
Suite Teardown    Delete Created Context Source Registration Subscriptions
${subscription_id_prefix}=    urn:ngsi-ld:Subscription:
${subscription_payload_file_path}=    csourceSubscriptions/subscription-sample.jsonld

*** Test Case ***
Create Context Source Registration Subscription
    [Documentation]    Check that you can create a minimal context source registration subscription
    [Tags]    csrsub-create    5_11_2
    ${subscription_payload}=    Load Test Sample    ${subscription_payload_file_path}    ${subscription_id}
    Create Context Source Registration Subscription    ${subscription_payload}
    Check Response Status Code Set To    201
    Check Response Headers Containing URI set to    ${request['path']}/    ${subscription_id}    ${response}
    Retrieve Context Source Registration Subscription    ${subscription_id}    context=${ngsild_test_suite_context}    accept=${CONTENT_TYPE_LD_JSON}
    ${ignored_attributes}=    Create List    ${status_regex_expr}
    Check Created Resource Set To    ${subscription_payload}    ${ignored_attributes}
*** Keywords ***
Generate Random Ids For Context Source Registration Subscriptions
    # TODO: Refactor Generate Random Entity Id to Generate Random Test Sample Id
    ${subscription_id}=    Generate Random Entity Id    ${subscription_id_prefix}
    Set Suite Variable    ${subscription_id}

Delete Created Context Source Registration Subscriptions
    Delete Context Source Registration Subscription    ${subscription_id}