Commit 1cc4b7d4 authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

fix(034_02): update expected status codes and invalid update fragment

parent 78bf442d
Loading
Loading
Loading
Loading
+11 −9
Original line number Original line Diff line number Diff line
@@ -18,34 +18,36 @@ ${registration_payload_file_path}= context-source-registration-invalid-samp


*** Test Cases ***
*** Test Cases ***
034_02_01 Update a context source registration by id if the Id is not present
034_02_01 Update a context source registration by id if the Id is not present
    ${EMPTY}    fragments/context-source-registration-different-type-sample.jsonld
    ${EMPTY}    fragments/context-source-registration-different-type-sample.jsonld    405    ${EMPTY}
034_02_02 Update a context source registration by id if the Id is not a valid URI
034_02_02 Update a context source registration by id if the Id is not a valid URI
    invalidURI    fragments/context-source-registration-different-type-sample.jsonld
    invalidURI    fragments/context-source-registration-different-type-sample.jsonld    400    ${ERROR_TYPE_BAD_REQUEST_DATA}
034_02_03 Update a context source registration if the request body is not of the same data type
034_02_03 Update a context source registration if the request body is not of the same data type
    ${valid_registration_id}    fragments/context-source-registration-different-type-sample.jsonld
    ${valid_registration_id}    fragments/context-source-registration-different-type-sample.jsonld    400    ${ERROR_TYPE_BAD_REQUEST_DATA}
034_02_04 Update a context source registration if you attempt to remove a mandatory property
034_02_04 Update a context source registration if you attempt to remove a mandatory property
    ${valid_registration_id}    context-source-registration-invalid-structure-sample.jsonld
    ${valid_registration_id}    context-source-registration-invalid-sample.jsonld    400    ${ERROR_TYPE_BAD_REQUEST_DATA}




*** Keywords ***
*** Keywords ***
Update A Context Source
Update A Context Source
    [Documentation]    Check that you cannot update a context source registration under some conditions
    [Documentation]    Check that you cannot update a context source registration under some conditions
    [Tags]    csr-update    5_9_3
    [Tags]    csr-update    5_9_3
    [Arguments]    ${registration_id}    ${fragment_filename}
    [Arguments]    ${registration_id}    ${fragment_filename}    ${expected_status_code}    ${problem_type}
    ${fragment}=    Load JSON From File    ${EXECDIR}/data/csourceRegistrations/${fragment_filename}
    ${fragment}=    Load JSON From File    ${EXECDIR}/data/csourceRegistrations/${fragment_filename}
    ${fragment_with_id}=    Update Value To JSON    ${fragment}    $..id    ${registration_id}
    ${fragment_with_id}=    Update Value To JSON    ${fragment}    $.id    ${registration_id}
    ${response}=    Update Context Source Registration With Return
    ${response}=    Update Context Source Registration With Return
    ...    ${registration_id}
    ...    ${registration_id}
    ...    ${fragment_with_id}
    ...    ${fragment_with_id}
    ...    ${CONTENT_TYPE_LD_JSON}
    ...    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    400    ${response.status_code}
    Check Response Status Code    ${expected_status_code}    ${response.status_code}
    IF    "${problem_type}"!="${EMPTY}"
        Check Response Body Containing ProblemDetails Element Containing Title Element    ${response.json()}
        Check Response Body Containing ProblemDetails Element Containing Title Element    ${response.json()}
    END


Create Initial Context Source Registration
Create Initial Context Source Registration
    ${valid_registration_id}=    Generate Random Entity Id    ${registration_id_prefix}
    ${valid_registration_id}=    Generate Random Entity Id    ${registration_id_prefix}
    Set Suite Variable    ${valid_registration_id}
    Set Suite Variable    ${valid_registration_id}
    ${payload}=    Load JSON From File    ${EXECDIR}/data/csourceRegistrations/${filename}
    ${payload}=    Load JSON From File    ${EXECDIR}/data/csourceRegistrations/${filename}
    ${updated_payload}=    Update Value To JSON    ${payload}    $..id    ${valid_registration_id}
    ${updated_payload}=    Update Value To JSON    ${payload}    $.id    ${valid_registration_id}
    ${response}=    Create Context Source Registration With Return    ${updated_payload}
    ${response}=    Create Context Source Registration With Return    ${updated_payload}
    Check Response Status Code    201    ${response.status_code}
    Check Response Status Code    201    ${response.status_code}