Skip to content
038_05.robot 2.26 KiB
Newer Older
Documentation       Check that you can create a context source registration subscription with an expiresAt member and when it is due the status of the subscription changes to "expired"

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


*** Variables ***
${subscription_id_prefix}=              urn:ngsi-ld:Subscription:
${subscription_payload_file_path}=      csourceSubscriptions/subscription-expiresAt-sample.jsonld


*** Test Cases ***
lopezaguilar's avatar
lopezaguilar committed
038_05_01 Create Context Source Registration Subscription With expiresAt Member
    [Documentation]    Check that you can create a context source registration subscription with an expiresAt member and when it is due the status of the subscription changes to "expired"
    [Tags]    csrsub-create    5_11_2
    ${subscription_payload_sample}=    Load Test Sample    ${subscription_payload_file_path}    ${subscription_id}
    ${current_date}=    Get Current Date    time_zone=UTC    result_format=${date_format}
    ${expiresAt}=    Add Time To Date    ${current_date}    10 seconds    date_format=${date_format}
    ${subscription_payload}=    Update Value To JSON    ${subscription_payload_sample}    $..expiresAt    ${expiresAt}
poujol's avatar
poujol committed
    ${response}=    Create Context Source Registration Subscription    ${subscription_payload}
    Check Response Status Code    201    ${response.status_code}
    Check Response Headers Containing URI set to    ${subscription_id}    ${response.headers}
lopezaguilar's avatar
lopezaguilar committed
    ${response}=    Retrieve Context Source Registration Subscription
    ...    subscription_id=${subscription_id}
    Check Response Body Containing an Attribute set to    status    ${response.json()}    expired
*** Keywords ***
Generate Random Ids For Context Source Registration Subscriptions
    ${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}