feat(head): add TCs for HEAD errors, the GET's 400 or 404 and no body (061_02)

New Test Cases for the errors of HEAD (TS 104-176 clause 5): a HEAD request that the GET would answer with an error gets the same status code, and no body. Stacked on the HEAD MR (feat/head-success), for its Request With HEAD keyword.

  • 061_02: 400 for /entities/ and /temporal/entities/ without any query parameter, and for /csourceRegistrations/ without entity types and attribute names; 400 for an invalid id and 404 for an unknown one on /entities/{entityId}, /subscriptions/{subscriptionId}, /temporal/entities/{entityId}, /csourceRegistrations/{registrationId}, /csourceSubscriptions/{subscriptionId}; 404 on /types/{type}, /attributes/{attrId} and /jsonldContexts/{contextId} for an unknown one

16 Test Cases in TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyHEAD/061_02.robot, one template, all tagged since_ts104_v1.1.1.

Doc unit tests 12/12, statisticsDocumentationData.py 0 of 578 failed, robocop format --check clean, no new unused test data. Against coraine: 16/16.

MR 3 of the plan: https://famzang.com/ttf/ngsi-ld-suite-plan.html

Merge request reports

Loading
+70 −0
Changes for TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyHEAD/061_02.robot: 70 added lines, 0 removed lines.
Original line number Diff line number Diff line
*** Settings ***
Documentation       Verify that a HEAD request that the corresponding GET request would answer with an error is answered with the same error status code and no body

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

Test Template       Request With HEAD Answered With An Error


*** Test Cases ***    PATH    CONTEXT    EXPECTED_STATUS_CODE
061_02_01 Endpoint /entities/ Without Any Query Parameter
    [Tags]    since_ts104_v1.1.1    e-query    cb-head    http_5    http_7_2_3_1
    entities/    ${EMPTY}    400
061_02_02 Endpoint /entities/{entityId} If The Entity Id Is Not A Valid URI
    [Tags]    since_ts104_v1.1.1    e-retrieve    cb-head    http_5    http_7_3_3_1
    entities/thisisaninvaliduri    ${EMPTY}    400
061_02_03 Endpoint /entities/{entityId} If The Entity Is Not Known
    [Tags]    since_ts104_v1.1.1    e-retrieve    cb-head    http_5    http_7_3_3_1
    entities/urn:ngsi-ld:Building:unknown061    ${EMPTY}    404
061_02_04 Endpoint /subscriptions/{subscriptionId} If The Subscription Id Is Not A Valid URI
    [Tags]    since_ts104_v1.1.1    sub-retrieve    cb-head    http_5    http_7_14_3_1
    subscriptions/thisisaninvaliduri    ${EMPTY}    400
061_02_05 Endpoint /subscriptions/{subscriptionId} If The Subscription Is Not Known
    [Tags]    since_ts104_v1.1.1    sub-retrieve    cb-head    http_5    http_7_14_3_1
    subscriptions/urn:ngsi-ld:Subscription:unknown061    ${EMPTY}    404
061_02_06 Endpoint /types/{type} If The Type Is Not Known
    [Tags]    since_ts104_v1.1.1    ed-type    cb-head    http_5    http_7_16_3_1
    types/UnknownType061    ${ngsild_test_suite_context}    404
061_02_07 Endpoint /attributes/{attrId} If The Attribute Is Not Known
    [Tags]    since_ts104_v1.1.1    ed-attr    cb-head    http_5    http_7_18_3_1
    attributes/unknownAttribute061    ${ngsild_test_suite_context}    404
061_02_08 Endpoint /temporal/entities/ Without Any Query Parameter
    [Tags]    since_ts104_v1.1.1    te-query    cb-head    http_5    http_8_2_3_1
    temporal/entities/    ${EMPTY}    400
061_02_09 Endpoint /temporal/entities/{entityId} If The Entity Id Is Not A Valid URI
    [Tags]    since_ts104_v1.1.1    te-retrieve    cb-head    http_5    http_8_3_3_1
    temporal/entities/thisisaninvaliduri    ${EMPTY}    400
061_02_10 Endpoint /temporal/entities/{entityId} If The Entity Is Not Known
    [Tags]    since_ts104_v1.1.1    te-retrieve    cb-head    http_5    http_8_3_3_1
    temporal/entities/urn:ngsi-ld:Vehicle:unknown061    ${EMPTY}    404
061_02_11 Endpoint /csourceRegistrations/ Without Entity Types And Attribute Names
    [Tags]    since_ts104_v1.1.1    csr-query    cb-head    http_5    http_9_2_3_1
    csourceRegistrations/    ${ngsild_test_suite_context}    400
061_02_12 Endpoint /csourceRegistrations/{registrationId} If The Registration Id Is Not A Valid URI
    [Tags]    since_ts104_v1.1.1    csr-retrieve    cb-head    http_5    http_9_3_3_1
    csourceRegistrations/thisisaninvaliduri    ${EMPTY}    400
061_02_13 Endpoint /csourceRegistrations/{registrationId} If The Registration Is Not Known
    [Tags]    since_ts104_v1.1.1    csr-retrieve    cb-head    http_5    http_9_3_3_1
    csourceRegistrations/urn:ngsi-ld:ContextSourceRegistration:unknown061    ${EMPTY}    404
061_02_14 Endpoint /csourceSubscriptions/{subscriptionId} If The Subscription Id Is Not A Valid URI
    [Tags]    since_ts104_v1.1.1    csrsub-retrieve    cb-head    http_5    http_9_5_3_1
    csourceSubscriptions/thisisaninvaliduri    ${EMPTY}    400
061_02_15 Endpoint /csourceSubscriptions/{subscriptionId} If The Subscription Is Not Known
    [Tags]    since_ts104_v1.1.1    csrsub-retrieve    cb-head    http_5    http_9_5_3_1
    csourceSubscriptions/urn:ngsi-ld:Subscription:unknown061    ${EMPTY}    404
061_02_16 Endpoint /jsonldContexts/{contextId} If The @context Is Not Known
    [Tags]    since_ts104_v1.1.1    ctx-serve    cb-head    http_5    http_10_3_3_1
    jsonldContexts/unknownContext061    ${EMPTY}    404


*** Keywords ***
Request With HEAD Answered With An Error
    [Documentation]    Verify that a HEAD request that the GET request would answer with an error gets the same status code and no body
    [Arguments]    ${path}    ${context}    ${expected_status_code}

    ${response}=    Request With HEAD
    ...    path=${path}
    ...    context=${context}
    Check Response Status Code    ${expected_status_code}    ${response.status_code}
    Check Response Body Is Empty    ${response}
Loading