Commit 3081f818 authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

fix: TCs that should expect a 405 instead of a 400

parent 4f599a74
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that you cannot get an entity with invalid/missing id
Documentation       Check that you cannot get an entity with invalid id

Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource            ${EXECDIR}/resources/AssertionUtils.resource

Test Template       Get Entity With Invalid/Missing Id
Test Template       Get Entity With Invalid Id


*** Test Cases ***    ENTITY_ID    EXPECTED_STATUS_CODE    PROBLEM_TYPE
018_02_01 Get an entity if the Entity Id is not present
    ${EMPTY}    400    ${ERROR_TYPE_BAD_REQUEST_DATA}
018_02_02 Get an entity if the Entity Id is not a valid URI
018_02_01 Get an entity if the Entity Id is not a valid URI
    thisisaninvaliduri    400    ${ERROR_TYPE_BAD_REQUEST_DATA}


*** Keywords ***
Get Entity With Invalid/Missing Id
Get Entity With Invalid Id
    [Documentation]    Check that you cannot get an entity with invalid/missing id
    [Tags]    e-retrieve    5_7_1
    [Arguments]    ${entity_id}    ${expected_status_code}    ${problem_type}
+7 −5
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ Test Template Delete Entity Scenarios
*** Test Cases ***    ENTITY_ID    EXPECTED_STATUS_CODE    PROBLEM_TYPE
002_02_01 Delete an entity if the Entity Id is not present
    [Tags]    e-delete    5_6_6
    ${EMPTY}    400    ${ERROR_TYPE_BAD_REQUEST_DATA}
    ${EMPTY}    405    ${EMPTY}
002_02_02 Delete an entity if the Entity Id is not a valid URI
    [Tags]    e-delete    5_6_6
    thisisaninvaliduri    400    ${ERROR_TYPE_BAD_REQUEST_DATA}
@@ -23,7 +23,9 @@ Delete Entity Scenarios
    [Arguments]    ${entity_id}    ${expected_status_code}    ${problem_type}
    ${response}=    Delete Entity by Id    ${entity_id}
    Check Response Status Code    ${expected_status_code}    ${response.status_code}
    IF    "${problem_type}"!="${EMPTY}"
        Check Response Body Containing ProblemDetails Element Containing Type Element set to
        ...    ${response.json()}
        ...    ${problem_type}
        Check Response Body Containing ProblemDetails Element Containing Title Element    ${response.json()}
    END
+6 −7
Original line number Diff line number Diff line
@@ -12,24 +12,23 @@ Test Template Delete Attributes

*** Variables ***
${vehicle_id_prefix}=       urn:ngsi-ld:Vehicle:
${status_code}=             400
${filename}=                vehicle-two-datasetid-attributes-sample.jsonld


*** Test Cases ***    ENTITY_ID    ATTRIBUTE_ID
*** Test Cases ***    ENTITY_ID    ATTRIBUTE_ID    EXPECTED_STATUS_CODE
013_02_01 Delete an attribute if the Entity Id is not present
    ${EMPTY}    speed
    ${EMPTY}    speed    400
013_02_02 Delete an attribute if the Entity Id is not a valid URI
    thisIsAnInvalidURI    speed
    thisIsAnInvalidURI    speed    400
013_02_03 Delete an attribute if the Attribute Name is not present
    ${valid_entity_id}    ${EMPTY}
    ${valid_entity_id}    ${EMPTY}    405


*** Keywords ***
Delete Attributes
    [Documentation]    Check that you cannot delete an attribute from an entity with invalid/missing ids
    [Tags]    ea-delete    5_6_5
    [Arguments]    ${entity_id}    ${attribute_id}
    [Arguments]    ${entity_id}    ${attribute_id}    ${expected_status_code}
    ${create_response}=    Create Entity Selecting Content Type
    ...    ${filename}
    ...    ${valid_entity_id}
@@ -40,7 +39,7 @@ Delete Attributes
    ...    attributeId=${attribute_id}
    ...    datasetId=${EMPTY}
    ...    deleteAll=false
    Check Response Status Code    ${status_code}    ${response.status_code}
    Check Response Status Code    ${expected_status_code}    ${response.status_code}

Setup Initial Entities
    ${valid_entity_id}=    Generate Random Entity Id    ${vehicle_id_prefix}
+2 −4
Original line number Diff line number Diff line
@@ -21,11 +21,9 @@ ${status_code}= 400
    ${EMPTY}    speed    vehicle-speed-equal-datasetid-fragment.jsonld
012_02_02 Make a partial attribute update if the Entity Id is not a valid URI
    thisisaninvaliduri    speed    vehicle-speed-equal-datasetid-fragment.jsonld
012_02_03 Make a partial attribute update if the Attribute Id is not present
    ${valid_entity_id}    ${EMPTY}    vehicle-speed-equal-datasetid-fragment.jsonld
012_02_04 Make a partial attribute update if the Attribute type does not match
012_02_03 Make a partial attribute update if the Attribute type does not match
    ${valid_entity_id}    speed    vehicle-speed-equal-datasetid-different-type-fragment.jsonld
012_02_05 Make a partial attribute update if the entity fragment is empty
012_02_04 Make a partial attribute update if the entity fragment is empty
    ${valid_entity_id}    speed    empty-fragment.json


+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ ${default_attr_id}= speed
012_03_03 Partial update when no instance with the datasetId specified
    ${valid_entity_id}    ${default_attr_id}    vehicle-speed-unknown-datasetid-fragment.jsonld
012_03_04 Partial update when the Attribute Name does not exist in the entity
    ${valid_entity_id}    speed2    vehicle-speed-no-datasetid-fragment.jsonld
    ${valid_entity_id}    isParked2    vehicle-isparked-fragment.jsonld


*** Keywords ***
Loading