Commit 9e4da6fe authored by lopesg's avatar lopesg
Browse files

added append attributes suites

parent 792a45ef
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ Append entity attributes with invalid entity fragments
    Check Response Status Code  201    ${response['status']}

    ${response}=    Append Entity Attributes Using Session    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}    ${EMPTY}
    Check Response Status Code  400    ${response['status']}
    Check Response Status Code  400    ${response}
    #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}

+23 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you cannot append entity attributes if the entity id or attributes are not known to the system
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

*** Variable ***
${vehicle_id_prefix}=  urn:ngsi-ld:Vehicle:
${fragment_filename}=  vehicle-fragment-datasetid-sample-01-02.jsonld

*** Test Cases ***  
003_Append entity attributes when the entity id is not known to the system
    [Documentation]  Check that you cannot append entity attributes if the entity id or attributes are not known to the system
    [Tags]  mandatory  failing

    ${entity_id}=     Generate Random Entity Id    ${vehicle_id_prefix}
    ${response}=    Append Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}    ${EMPTY}
    Check Response Status Code  404    ${response['status']}
    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}

*** Keywords ***
    [Teardown]  Delete Entity by Id Returning Response   ${entity_id}
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
@@ -157,8 +157,9 @@ Append Entity Attributes Using Session
    ${file_content}=    Get File    ${EXECDIR}/data/entities/fragmentEntities/${fragment_filename}
    Create Session    OneRequest      ${url}
    &{headers}=  Create Dictionary  Content-Type=${content_type}
    ${response}=    POST On Session      OneRequest   ${ENTITIES_ENDPOINT_PATH}  data=${file_content}    headers=${headers}   expected_status=any
    Set Test Variable  ${response}
    ${response}=    POST On Session      OneRequest   ${ENTITIES_ENDPOINT_PATH}${id}/attrs    params=options=${options}    data=${file_content}    headers=${headers}   expected_status=any
    Output  ${response.json()}
    [return]    ${response}

Create Entity
    [Arguments]  ${filename}    ${entity_id}