Commit 77d76f36 authored by Houcem Kacem's avatar Houcem Kacem
Browse files

feat: implement test cases for retrieve subscription

parent 07944d57
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you cannot retrieve a subscription: If the subscription Id is not present or it is not a valid URI, then an error of type BadRequestData shall be raised
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource

Test Template  Retrieve Subscription With Non present Or Invalid Id

*** Test Cases ***          id
NotPresentId                ${EMPTY}
InvalidId                   InvalidUri

*** Keywords ***
Retrieve Subscription With Non present Or Invalid Id
    [Arguments]  ${id}
    [Documentation]  Check that you cannot retrieve a subscription: If the subscription Id is not present or it is not a valid URI, then an error of type BadRequestData shall be raised
    [Tags]  mandatory

    Retrieve Subscription   ${id}

    Check Response Status Code Set To  400
    Check Response Body Containing ProblemDetails Element Containing Type Element set to      ${response}     ${ERROR_TYPE_BAD_REQUEST_DATA}
    Check Response Body Containing ProblemDetails Element Containing Title Element    ${response}
+15 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you cannot retrieve a subscription: If the identifier provided does not correspond to any existing subscription in the system then an error of type ResourceNotFound shall be raised
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource

*** Test Case ***
Retrieve Unknown Subscription
    [Documentation]  Check that you cannot retrieve a subscription: If the identifier provided does not correspond to any existing subscription in the system then an error of type ResourceNotFound shall be raised
    [Tags]  mandatory

    Retrieve Subscription   unknownSubscription

    Check Response Status Code Set To  404
    Check Response Body Containing ProblemDetails Element Containing Type Element set to      ${response}     ${ERROR_TYPE_RESOURCE_NOT_FOUND}
    Check Response Body Containing ProblemDetails Element Containing Title Element    ${response}
+33 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can retrieve a subscription
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup      Setup Initial Subscriptions
Suite Teardown      Delete Initial Subscriptions

*** Variable ***
${subscription_id_prefix}=  urn:ngsi-ld:Subscription:
${subscription_payload_file_path}=   subscriptions/subscription-sample.jsonld

*** Test Case ***
Retrieve Subscription
    [Documentation]  Check that you can retrieve a subscription
    [Tags]  mandatory

    Retrieve Subscription   ${subscription_id}     context=${ngsild_test_suite_context}

    Check Response Status Code Set To  200
    Check Response Body Containing Subscription element     ${subscription_payload_file_path}   ${subscription_id}

*** Keywords ***
Setup Initial Subscriptions
    ${subscription_id}=     Generate Random Entity Id    ${subscription_id_prefix}

    Create Subscription  ${subscription_id}     ${subscription_payload_file_path}   ${CONTENT_TYPE_LD_JSON}

    Set Suite Variable  ${subscription_id}

Delete Initial Subscriptions
    Delete Subscription     ${subscription_id}
+1 −1

File changed.

Contains only whitespace changes.