Commit 469ad021 authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

fix(034_01/05): update endpoint info / set a CSR to never expire

parent 90a243b9
Loading
Loading
Loading
Loading
+10 −13
Original line number Diff line number Diff line
@@ -18,10 +18,7 @@ ${registration_id_prefix}= urn:ngsi-ld:Registration:
*** Test Cases ***    FILENAME    UPDATE_FILENAME
034_01_01 Update a context source registration by id
    [Tags]    csr-update    5_9_3
    context-source-registration-sample.jsonld    context-source-registration-with-expiration-sample.jsonld
034_01_02 Update a context source registration to never expire
    [Tags]    csr-update    5_9_3
    context-source-registration-with-expiration-sample.jsonld    context-source-registration-sample.jsonld
    context-source-registration-sample.jsonld    context-source-registration-update-sample.json


*** Keywords ***
@@ -29,18 +26,19 @@ Update A Context Source
    [Documentation]    Check that you can update a context source registration by id
    [Arguments]    ${filename}    ${update_filename}
    Set Test Variable    ${filename}
    ${fragment}=    Load JSON From File    ${EXECDIR}/data/csourceRegistrations/${update_filename}
    ${registration_update_fragment}=    Update Value To JSON    ${fragment}    $..id    ${registration_id}
    ${fragment}=    Load JSON From File    ${EXECDIR}/data/csourceRegistrations/fragments/${update_filename}
    ${registration_update_fragment}=    Update Value To JSON    ${fragment}    $.id    ${registration_id}
    ${response}=    Update Context Source Registration With Return
    ...    ${registration_id}
    ...    ${registration_update_fragment}
    ...    ${CONTENT_TYPE_LD_JSON}
    ...    ${CONTENT_TYPE_JSON}
    Check Response Status Code    204    ${response.status_code}
    Check Retrieving Context Source Registration
    ...    registration_id=${registration_id}
    ...    context=${ngsild_test_suite_context}
    ...    accept=${CONTENT_TYPE_LD_JSON}
    ...    registration_payload=${registration_payload}
    ${response1}=    Retrieve Context Source Registration
    ...    context_source_registration_id=${registration_id}
    Check JSON Value In Response Body
    ...    ['endpoint']
    ...    http://my.new.csource.org:1026
    ...    ${response1.json()}

Delete Updated Context Source Registration
    Delete Context Source Registration    ${registration_id}
@@ -48,7 +46,6 @@ Delete Updated Context Source Registration
Initialize the Test Case
    ${registration_id}=    Generate Random Entity Id    ${registration_id_prefix}
    Set Test Variable    ${registration_id}
    # ${payload}=    Load JSON From File    ${EXECDIR}/data/csourceRegistrations/${filename}
    ${payload}=    Load JSON From File
    ...    ${EXECDIR}/data/csourceRegistrations/context-source-registration-sample.jsonld
    ${registration_payload}=    Update Value To JSON    ${payload}    $..id    ${registration_id}
+53 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that you can update a context source registration by id

Resource            ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource
Resource            ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/JsonUtils.resource

Test Setup          Initialize the Test Case
Test Teardown       Delete Updated Context Source Registration
Test Template       Update A Context Source


*** Variables ***
${registration_id_prefix}=      urn:ngsi-ld:Registration:


*** Test Cases ***    FILENAME    UPDATE_FILENAME
034_05_01 Update a context source registration to never expire
    [Tags]    csr-update    5_9_3
    context-source-registration-with-expiration-sample.jsonld    context-source-registration-null-expiresAt.json


*** Keywords ***
Update A Context Source
    [Documentation]    Check that you can update a context source registration by id
    [Arguments]    ${filename}    ${update_filename}
    Set Test Variable    ${filename}
    ${fragment}=    Load JSON From File    ${EXECDIR}/data/csourceRegistrations/fragments/${update_filename}
    ${registration_update_fragment}=    Update Value To JSON    ${fragment}    $.id    ${registration_id}
    ${response}=    Update Context Source Registration With Return
    ...    ${registration_id}
    ...    ${registration_update_fragment}
    ...    ${CONTENT_TYPE_JSON}
    Check Response Status Code    204    ${response.status_code}
    ${response1}=    Retrieve Context Source Registration
    ...    context_source_registration_id=${registration_id}
    Check JSON Value Not In Response Body
    ...    $.expiresAt
    ...    ${response1.json()}

Delete Updated Context Source Registration
    Delete Context Source Registration    ${registration_id}

Initialize the Test Case
    ${registration_id}=    Generate Random Entity Id    ${registration_id_prefix}
    Set Test Variable    ${registration_id}
    ${payload}=    Load JSON From File
    ...    ${EXECDIR}/data/csourceRegistrations/context-source-registration-sample.jsonld
    ${registration_payload}=    Update Value To JSON    ${payload}    $..id    ${registration_id}
    Set Test Variable    ${registration_payload}
    ${response}=    Create Context Source Registration With Return    ${registration_payload}
    Check Response Status Code    201    ${response.status_code}
+3 −0
Original line number Diff line number Diff line
{
   "expiresAt": null
}
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -345,6 +345,10 @@ Check JSON Value In Response Body
    [Arguments]    ${json_path_expr}    ${value_to_check}    ${response_body}
    Should Be Equal As Strings    ${response_body${json_path_expr}}    ${value_to_check}

Check JSON Value Not In Response Body
    [Arguments]    ${json_path_expr}    ${response_body}
    Should Not Have Value In Json    ${response_body}    ${json_path_expr}

Check NotificationParams
    [Arguments]    ${filename}    ${expected_additional_members}    ${response_body}