feat(head): add TCs for HEAD on the Attribute, the Attribute value and /info/sourceIdentity (061_03, 061_04)

New Test Cases for HEAD on the Attribute, the Attribute value and the context source identity (TS 104-176 clause 5, 7.5.3.1, 7.6.3.1, 12.2.3.1). Stacked on the HEAD MR !337 (merged) (feat/head-success, which holds 061_01 and 061_02). The GET of these three resources is tested by !327 (merged), !333 (merged) and !328 (merged).

  • 061_03: 204, without Content-Length, on /entities/{entityId}/attrs/{attrId}, /entities/{entityId}/attrs/{attrId}/value and /info/sourceIdentity
  • 061_04: the GET's 400 or 404 on /attrs/{attrId} and /attrs/{attrId}/value - the six cases of 062_03 and 062_04: entity id not a valid URI (400), entity not known (404), attribute not known (404)

9 Test Cases in TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyHEAD/, all tagged since_ts104_v1.1.1.

As in !337 (merged), what is verified on success is the 204 and the missing Content-Length; the HTTP client does not read a body after a HEAD response.

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

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

Edited by Ken Zangelin

Merge request reports

Loading
+58 −0
Changes for TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyHEAD/061_03.robot: 58 added lines, 0 removed lines.
Original line number Diff line number Diff line
*** Settings ***
Documentation       Verify that a HEAD request on the Attribute, the Attribute value and the context source identity functions in the same manner as a GET request, and that the response code 204 No Content, without Content-Length, is used on success

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

Suite Setup         Create Initial Entity
Suite Teardown      Delete Initial Entity


*** Variables ***
${building_filename}=       building-simple-attributes.jsonld


*** Test Cases ***
061_03_01 Endpoint /entities/{entityId}/attrs/{attrId}
    [Documentation]    Verify that a HEAD request on /entities/{entityId}/attrs/{attrId} is answered with 204 No Content, without Content-Length
    [Tags]    since_ts104_v1.1.1    ea-retrieve    cb-head    http_5    http_7_5_3_1
    ${response}=    Request With HEAD
    ...    path=entities/${entity_id}/attrs/name
    ...    context=${ngsild_test_suite_context}
    Check Response Status Code    204    ${response.status_code}
    Check Response Body Is Empty    ${response}
    Check Response Headers Not Containing Content-Length    ${response.headers}

061_03_02 Endpoint /entities/{entityId}/attrs/{attrId}/value
    [Documentation]    Verify that a HEAD request on /entities/{entityId}/attrs/{attrId}/value is answered with 204 No Content, without Content-Length
    [Tags]    since_ts104_v1.1.1    ea-retrieve-value    cb-head    http_5    http_7_6_3_1
    ${response}=    Request With HEAD
    ...    path=entities/${entity_id}/attrs/name/value
    ...    context=${ngsild_test_suite_context}
    Check Response Status Code    204    ${response.status_code}
    Check Response Body Is Empty    ${response}
    Check Response Headers Not Containing Content-Length    ${response.headers}

061_03_03 Endpoint /info/sourceIdentity
    [Documentation]    Verify that a HEAD request on /info/sourceIdentity is answered with 204 No Content, without Content-Length
    [Tags]    since_ts104_v1.1.1    csi-retrieve    cb-head    http_5    http_12_2_3_1
    ${response}=    Request With HEAD
    ...    path=info/sourceIdentity
    Check Response Status Code    204    ${response.status_code}
    Check Response Body Is Empty    ${response}
    Check Response Headers Not Containing Content-Length    ${response.headers}


*** Keywords ***
Create Initial Entity
    ${entity_id}=    Generate Random Building Entity Id
    ${response}=    Create Entity Selecting Content Type
    ...    ${building_filename}
    ...    ${entity_id}
    ...    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${response.status_code}
    Set Suite Variable    ${entity_id}

Delete Initial Entity
    Delete Entity    ${entity_id}
+59 −0
Changes for TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyHEAD/061_04.robot: 59 added lines, 0 removed lines.
Original line number Diff line number Diff line
*** Settings ***
Documentation       Verify that a HEAD request on the Attribute or the Attribute value that the corresponding GET request would answer with an error is answered with the same error status code

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

Suite Setup         Create Initial Entity
Suite Teardown      Delete Initial Entity
Test Template       Request With HEAD Answered With An Error


*** Variables ***
${building_filename}=       building-simple-attributes.jsonld


*** Test Cases ***    PATH    CONTEXT    EXPECTED_STATUS_CODE
061_04_01 Endpoint /entities/{entityId}/attrs/{attrId} If The Attribute Is Not Known
    [Tags]    since_ts104_v1.1.1    ea-retrieve    cb-head    http_5    http_7_5_3_1
    entities/${entity_id}/attrs/unknownAttribute    ${ngsild_test_suite_context}    404
061_04_02 Endpoint /entities/{entityId}/attrs/{attrId}/value If The Attribute Is Not Known
    [Tags]    since_ts104_v1.1.1    ea-retrieve-value    cb-head    http_5    http_7_6_3_1
    entities/${entity_id}/attrs/unknownAttribute/value    ${ngsild_test_suite_context}    404
061_04_03 Endpoint /entities/{entityId}/attrs/{attrId}/value If The Entity Is Not Known
    [Tags]    since_ts104_v1.1.1    ea-retrieve-value    cb-head    http_5    http_7_6_3_1
    entities/urn:ngsi-ld:Building:unknown061/attrs/name/value    ${ngsild_test_suite_context}    404
061_04_04 Endpoint /entities/{entityId}/attrs/{attrId} If The Entity Id Is Not A Valid URI
    [Tags]    since_ts104_v1.1.1    ea-retrieve    cb-head    http_5    http_7_5_3_1
    entities/thisisaninvaliduri/attrs/name    ${ngsild_test_suite_context}    400
061_04_05 Endpoint /entities/{entityId}/attrs/{attrId} If The Entity Is Not Known
    [Tags]    since_ts104_v1.1.1    ea-retrieve    cb-head    http_5    http_7_5_3_1
    entities/urn:ngsi-ld:Building:unknown061/attrs/name    ${ngsild_test_suite_context}    404
061_04_06 Endpoint /entities/{entityId}/attrs/{attrId}/value If The Entity Id Is Not A Valid URI
    [Tags]    since_ts104_v1.1.1    ea-retrieve-value    cb-head    http_5    http_7_6_3_1
    entities/thisisaninvaliduri/attrs/name/value    ${ngsild_test_suite_context}    400


*** Keywords ***
Create Initial Entity
    ${entity_id}=    Generate Random Building Entity Id
    ${response}=    Create Entity Selecting Content Type
    ...    ${building_filename}
    ...    ${entity_id}
    ...    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${response.status_code}
    Set Suite Variable    ${entity_id}

Delete Initial Entity
    Delete Entity    ${entity_id}

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
    [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