Commit 557e6da3 authored by kzangeli's avatar kzangeli
Browse files

TS 104-175 § 8.4.2 / TS 104-176 § 6.3.5 (geolonia#32): 029_03 / 039_04 /...

TS 104-175 § 8.4.2 / TS 104-176 § 6.3.5 (geolonia#32): 029_03 / 039_04 / D002_02_01_inc back to develop (a partial notification replaces the whole one - 400; a source's 404 to a DELETE - 207); 037_05_01 / 037_08_01 accept the registration filtered or whole (§ 12.3.3.5 is a SHOULD); 031_01_01 accepts notificationTrigger absent or the default. testsuite-doubts #25 #45 #67 updated, #115-#117 new
parent 5c62f436
Loading
Loading
Loading
Loading
+8 −4
Changes for TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_03.robot: 8 added lines, 4 removed lines.
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that a partial Subscription Fragment (changing only notification.format) is applied by recursive merge (TS 104-175 clause 8.4.2 / RFC 7396), preserving the existing notification.endpoint, and returns 204 No Content
Documentation       Check that one cannot update a subscription: If the data types and restriction are not met by the Subscription Fragment, then an error of type BadRequestData shall be raised

Resource            ${EXECDIR}/resources/ApiUtils/Common.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource
@@ -16,14 +16,18 @@ ${subscription_update_fragment_file_path}= subscriptions/fragments/subscrip


*** Test Cases ***
029_03_01 Update Subscription With A Partial Notification Fragment
    [Documentation]    Check that a partial Subscription Fragment (changing only notification.format) is applied by recursive merge (TS 104-175 clause 8.4.2 / RFC 7396), preserving the existing notification.endpoint, and returns 204 No Content
029_03_01 Update Subscription With Invalid Fragment
    [Documentation]    Check that one cannot update a subscription: If the data types and restriction are not met by the Subscription Fragment, then an error of type BadRequestData shall be raised
    [Tags]    sub-update    5_8_2
    ${response}=    Update Subscription
    ...    ${subscription_id}
    ...    ${subscription_update_fragment_file_path}
    ...    ${CONTENT_TYPE_JSON}
    Check Response Status Code    204    ${response.status_code}
    Check Response Status Code    400    ${response.status_code}
    Check Response Body Containing ProblemDetails Element Containing Type Element set to
    ...    ${response.json()}
    ...    ${ERROR_TYPE_BAD_REQUEST_DATA}
    Check Response Body Containing ProblemDetails Element Containing Title Element    ${response.json()}


*** Keywords ***
+1 −1
Changes for TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_05.robot: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ Query Context Source Registration Matching EntityInfo of RegistrationInfo

    @{expected_context_source_registration_ids}=    Create List    ${context_source_registration_id}
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing List Containing Context Source Registrations elements
    Check Response Body Containing List Containing Context Source Registrations elements, Filtered Or Whole
    ...    ${expectation_file_path}
    ...    ${expected_context_source_registration_ids}
    ...    ${response.json()}
+1 −1
Changes for TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_08.robot: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ ${expectation_file_path}= csourceRegistrations/exp
    ${response}=    Query Context Source Registrations    context=${ngsild_test_suite_context}    type=Vehicle
    @{expected_context_source_registration_ids}=    Create List    ${context_source_registration_id}
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing List Containing Context Source Registrations elements
    Check Response Body Containing List Containing Context Source Registrations elements, Filtered Or Whole
    ...    ${expectation_file_path}
    ...    ${expected_context_source_registration_ids}
    ...    ${response.json()}
+17 −14
Changes for TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_04.robot: 17 added lines, 14 removed lines.
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check the behaviour of updating a context source registration subscription with a fragment: a fragment changing a read-only field is rejected (BadRequestData), while a partial fragment is applied by recursive merge (TS 104-175 clause 8.4.2 / RFC 7396)
Documentation       Check that one cannot update a context source registration subscription with a fragment that does not meet the data types and restrictions expressed by clause 5.2.12

Resource            ${EXECDIR}/resources/ApiUtils/Common.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource
@@ -8,32 +8,35 @@ Resource ${EXECDIR}/resources/JsonUtils.resource

Test Setup          Setup Initial Context Source Registration Subscriptions
Test Teardown       Delete Initial Context Source Registration Subscriptions
Test Template       Update Context Source Registration Subscription With Invalid Fragment


*** Variables ***
${subscription_payload_file_path}=      csourceSubscriptions/subscription.jsonld


*** Test Cases ***
*** Test Cases ***    FILEPATH
039_04_01 InvalidType
    [Documentation]    A fragment changing the read-only 'type' is rejected with BadRequestData.
    [Tags]    csrsub-update    5_11_3
    ${fragment}=    Load Test Sample    csourceSubscriptions/fragments/subscription-update-invalid-type.json
    ${response}=    Update Context Source Registration Subscription    ${subscription_id}    ${fragment}
    csourceSubscriptions/fragments/subscription-update-invalid-type.json
039_04_02 InvalidNotification
    [Tags]    csrsub-update    5_11_3
    csourceSubscriptions/fragments/subscription-update-invalid-notification.json


*** Keywords ***
Update Context Source Registration Subscription With Invalid Fragment
    [Documentation]    Check that one cannot update a context source registration subscription with a fragment that does not meet the data types and restrictions expressed by clause 5.2.12
    [Arguments]    ${filepath}
    ${subscription_update_fragment}=    Load Test Sample    ${filepath}
    ${response}=    Update Context Source Registration Subscription
    ...    ${subscription_id}
    ...    ${subscription_update_fragment}
    Check Response Status Code    400    ${response.status_code}
    Check Response Body Containing ProblemDetails Element
    ...    response_body=${response.json()}
    ...    problem_type=${ERROR_TYPE_BAD_REQUEST_DATA}

039_04_02 PartialNotificationUpdate
    [Documentation]    A partial fragment changing only notification.format is applied by recursive merge (clause 8.4.2 / RFC 7396), preserving the existing endpoint, and returns 204 No Content.
    [Tags]    csrsub-update    5_11_3
    ${fragment}=    Load Test Sample    csourceSubscriptions/fragments/subscription-update-invalid-notification.json
    ${response}=    Update Context Source Registration Subscription    ${subscription_id}    ${fragment}
    Check Response Status Code    204    ${response.status_code}


*** Keywords ***
Setup Initial Context Source Registration Subscriptions
    ${subscription_id}=    Generate Random Subscription Id
    ${subscription_payload}=    Load Test Sample    ${subscription_payload_file_path}    ${subscription_id}
+3 −2
Changes for TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_01_inc.robot: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -21,11 +21,12 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi

*** Test Cases ***
D002_02_01_inc Delete Entity On The Context Broker
    [Documentation]    Verify that, when one has an inclusive registration on a Context Broker, one is able to delete an entity that exists locally. A 404 from an inclusive Context Source that simply does not hold the entity is not an error (TS 104-175 § 10.2.8.4 reserves ResourceNotFound for the case where neither the broker nor any registration knows the entity), so the operation returns 204 No Content.
    [Documentation]    Verify that, when one has an inclusive registration on a Context Broker, one is able to delete entities locally and should get a BatchOperationResult structure
    [Tags]    since_v1.6.1    dist-ops    4_3_3    cf_04    additive-inclusive    4_3_6_2    5_6_6    6_3_3
    Set Stub Reply    DELETE    /ngsi-ld/v1/entities/${entity_id}    404
    ${response}=    Delete Entity    ${entity_id}
    Check Response Status Code    204    ${response.status_code}
    Check Response Status Code    207    ${response.status_code}
    Check JSON Value In Response Body    ['status']    404    ${response.json()['errors'][0]['error']}

    ${response_retrieve}=    Retrieve Entity    ${entity_id}    local=true
    Check Response Status Code    404    ${response_retrieve.status_code}
Loading