Commit 4b79906c authored by Patricia dos Santos Oliveira's avatar Patricia dos Santos Oliveira
Browse files

Merge branch 'feature/delete-entities' into 'develop'

Feature/delete entities

See merge request !10
parents 430db3f6 1bb9964d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -26,8 +26,8 @@ Create Entity Scenarios

    ${entity_id}=     Generate Random Entity Id    ${building_id_prefix}

    Create Entity Selecting Content Type   ${filename}      ${entity_id}     ${content_type}
    Check Response Status Code Set To  201
    Check Response Headers Containing URI set to    ${request['path']}    ${entity_id}
    ${request}    ${response}=    Create Entity Selecting Content Type   ${filename}      ${entity_id}     ${content_type}
    Check Response Status Code  201    ${response['status']}
    Check Response Headers Containing URI set to    ${request['path']}    ${entity_id}    ${response}

    [Teardown]    Delete Entity by Id       ${entity_id}
 No newline at end of file
+6 −5
Original line number Diff line number Diff line
@@ -16,13 +16,14 @@ Create one valid entity and one invalid entity
    [Tags]  mandatory

    ${entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    Create Entity Selecting Content Type   ${filename}    ${entity_id}    ${content_type}
    Check Response Status Code Set To  201
    ${request}    ${response}=    Create Entity Selecting Content Type   ${filename}    ${entity_id}    ${content_type}
    Check Response Status Code  201    ${response['status']}

    #creating entity with the same id
    Create Entity Selecting Content Type   ${filename}    ${entity_id}    ${content_type}
    Check Response Status Code Set To  409
    Check Response Body Details Containing Information Error  ${expected_error_message}
    ${request}    ${response}=    Create Entity Selecting Content Type   ${filename}    ${entity_id}    ${content_type}
    Check Response Status Code  409    ${response['status']}
    Check Response Body Containing ProblemDetails Element Containing Type Element set to      ${response}     ${ERROR_TYPE_ALREADY_EXISTS}
    Check Response Body Containing ProblemDetails Element Containing Title Element    ${response}

    [Teardown]    Delete Entity by Id       ${entity_id}
+20 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can delete an entity by id
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

*** Variable ***
${building_id_prefix}=  urn:ngsi-ld:Building:

*** Test Case ***
004_Delete an entity
    [Documentation]  Check that you can delete an entity by id
    [Tags]  mandatory

    ${entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${request}    ${response}=    Create Entity Selecting Content Type  building-simple-attributes-sample.jsonld     ${entity_id}    application/ld+json
    Check Response Status Code  201    ${response['status']}

    ${response}=    Delete Entity by Id Returning Response   ${entity_id}
    Check Response Status Code  204    ${response['status']}
+28 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you cannot delete an entity with invalid/missing id
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Test Template  Delete Entity Scenarios

*** Variable ***
${entity_id_empty}=        
${entity_id_not_valid}=     thisisaninvaliduri

*** Test Cases ***                                                  ENTITY_ID                     EXPECTED_STATUS_CODE       PROBLEM_TYPE                      
005_01_Delete an entity if the Entity Id is not present             ${entity_id_empty}            400                        ${ERROR_TYPE_BAD_REQUEST_DATA}
005_02_Delete an entity if the Entity Id is not a valid URI         ${entity_id_not_valid}        400                        ${ERROR_TYPE_BAD_REQUEST_DATA}



*** Keywords ***
Delete Entity Scenarios
    [Arguments]  ${entity_id}    ${expected_status_code}    ${problem_type}
    [Documentation]  Check that you cannot delete an entity with invalid/missing id
    [Tags]  mandatory    failing

    ${response}=    Delete Entity by Id Returning Response   ${entity_id}
    Check Response Status Code  ${expected_status_code}    ${response['status']}
    Check Response Body Containing ProblemDetails Element Containing Type Element set to      ${response}     ${problem_type}
    Check Response Body Containing ProblemDetails Element Containing Title Element    ${response}
 No newline at end of file
+21 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you cannot delete an entity if the entity id is not known to the system
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

*** Variable ***
${building_id_prefix}=  urn:ngsi-ld:Building:
${expected_status_code}=  404

*** Test Case ***
006_Delete an entity with an id not known to the system
    [Documentation]  Check that you cannot delete an entity if the entity id is not known to the system
    [Tags]  mandatory

    ${entity_id}=     Generate Random Entity Id    ${building_id_prefix}

    ${response}=    Delete Entity by Id Returning Response   ${entity_id}
    Check Response Status Code  ${expected_status_code}    ${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}
 No newline at end of file
Loading