Commit 8bfe06df authored by kzangeli's avatar kzangeli Committed by Ken Zangelin
Browse files

refactor(entity-attributes): Retrieve Attribute TCs after the review of !327

- Moved to Consumption/EntityAttributes/RetrieveAttributeValue (TP id CI/Cons/EA/062_xx), as the ea-retrieve
  tag and the Provision layout have it.
- 062_03: the template argument is named as its column (${entity_id}), so the generated steps show the Entity
  Id of each permutation; the suite variable is ${building_id}, else the generator substitutes ${entity_id}
  into itself (RecursionError). The ProblemDetails title is checked.
- 062_01: the response Content-Type is checked (application/json).
- 062_06: lang (a LanguageProperty in one language, and whole without lang); 062_07: type (the Entity's type:
  200; another type: 404, TS 104 175 clause 10.4.4.4).
- Retrieve Entity Attribute: no accept argument (no TC used it); one IF style in Build Entity Attribute Request.
- since_ts104_v1.1.1 on every 062 TC: Retrieve Attribute (TS 104 175 clause 10.4.4) has no ETSI GS CIM 009
  counterpart. doc/README.md documents the tag form; statisticsDocumentationData keeps everything after
  "since_" as the release (ts104_v1.1.1), not only the last part.

Co-Authored-By: default avatarClaude Opus 5.5 <noreply@anthropic.com>
parent e12634ea
Loading
Loading
Loading
Loading
+3 −2
Changes for TP/NGSI-LD/ContextInformation/Consumption/EntityAttributes/RetrieveAttributeValue/062_01.robot: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -17,10 +17,10 @@ ${filename}= building-simple-attributes.jsonld

*** Test Cases ***    ATTRIBUTE    EXPECTATION_FILENAME
062_01_01 Retrieve A Property
    [Tags]    ea-retrieve    core_10_4_4    http_7_5_3_1
    [Tags]    since_ts104_v1.1.1    ea-retrieve    core_10_4_4    http_7_5_3_1
    name    attribute-fragment-name.json
062_01_02 Retrieve A Property With Sub-Attributes
    [Tags]    ea-retrieve    core_10_4_4    http_7_5_3_1
    [Tags]    since_ts104_v1.1.1    ea-retrieve    core_10_4_4    http_7_5_3_1
    airQualityLevel    attribute-fragment-airqualitylevel.json


@@ -46,4 +46,5 @@ Retrieve An Attribute Of An Entity
    ...    attr_id=${attribute}
    ...    context=${ngsild_test_suite_context}
    Check Response Status Code    200    ${response.status_code}
    Check Response Headers Containing Content-Type set to    ${CONTENT_TYPE_JSON}    ${response.headers}
    Check Response Body Content    ${expectation_filename}    ${response.json()}
+11 −10
Changes for TP/NGSI-LD/ContextInformation/Consumption/EntityAttributes/RetrieveAttributeValue/062_03.robot: 11 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -16,38 +16,39 @@ ${filename}= building-simple-attributes.jsonld

*** Test Cases ***    ENTITY_ID    ATTRIBUTE    EXPECTED_STATUS_CODE    PROBLEM_TYPE
062_03_01 Retrieve An Attribute If The Entity Id Is Not A Valid URI
    [Tags]    ea-retrieve    core_10_4_4    http_7_5_3_1
    [Tags]    since_ts104_v1.1.1    ea-retrieve    core_10_4_4    http_7_5_3_1
    thisisaninvaliduri    name    400    ${ERROR_TYPE_BAD_REQUEST_DATA}
062_03_02 Retrieve An Attribute If The Entity Is Not Known
    [Tags]    ea-retrieve    core_10_4_4    http_7_5_3_1
    [Tags]    since_ts104_v1.1.1    ea-retrieve    core_10_4_4    http_7_5_3_1
    urn:ngsi-ld:Building:unknown062    name    404    ${ERROR_TYPE_RESOURCE_NOT_FOUND}
062_03_03 Retrieve An Attribute If The Attribute Is Not Known
    [Tags]    ea-retrieve    core_10_4_4    http_7_5_3_1
    ${entity_id}    unknownAttribute    404    ${ERROR_TYPE_RESOURCE_NOT_FOUND}
    [Tags]    since_ts104_v1.1.1    ea-retrieve    core_10_4_4    http_7_5_3_1
    ${building_id}    unknownAttribute    404    ${ERROR_TYPE_RESOURCE_NOT_FOUND}


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

Delete Initial Entity
    Delete Entity    ${entity_id}
    Delete Entity    ${building_id}

Retrieve An Attribute With An Error
    [Documentation]    Check that one cannot retrieve an Attribute of an Entity that is not valid or not known
    [Arguments]    ${id}    ${attribute}    ${expected_status_code}    ${problem_type}
    [Arguments]    ${entity_id}    ${attribute}    ${expected_status_code}    ${problem_type}

    ${response}=    Retrieve Entity Attribute
    ...    id=${id}
    ...    id=${entity_id}
    ...    attr_id=${attribute}
    ...    context=${ngsild_test_suite_context}
    Check Response Status Code    ${expected_status_code}    ${response.status_code}
    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()}
+3 −3
Changes for TP/NGSI-LD/ContextInformation/Consumption/EntityAttributes/RetrieveAttributeValue/062_05.robot: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ ${filename}= vehicle-speed-two-datasetid.jsonld
*** Test Cases ***
062_05_01 Retrieve An Attribute Instance By datasetId
    [Documentation]    Check that the datasetId parameter selects the Attribute instance returned
    [Tags]    ea-retrieve    core_10_4_4    http_7_5_3_1
    [Tags]    since_ts104_v1.1.1    ea-retrieve    core_10_4_4    http_7_5_3_1
    ${response}=    Retrieve Entity Attribute
    ...    id=${entity_id}
    ...    attr_id=speed
@@ -28,7 +28,7 @@ ${filename}= vehicle-speed-two-datasetid.jsonld

062_05_02 Retrieve An Attribute Without A Default Instance
    [Documentation]    Check that an Attribute that has no default instance is not found when no datasetId is given
    [Tags]    ea-retrieve    core_10_4_4    http_7_5_3_1
    [Tags]    since_ts104_v1.1.1    ea-retrieve    core_10_4_4    http_7_5_3_1
    ${response}=    Retrieve Entity Attribute
    ...    id=${entity_id}
    ...    attr_id=speed
@@ -40,7 +40,7 @@ ${filename}= vehicle-speed-two-datasetid.jsonld

062_05_03 Retrieve An Attribute Instance By An Unknown datasetId
    [Documentation]    Check that an Attribute that has no instance with the datasetId given is not found
    [Tags]    ea-retrieve    core_10_4_4    http_7_5_3_1
    [Tags]    since_ts104_v1.1.1    ea-retrieve    core_10_4_4    http_7_5_3_1
    ${response}=    Retrieve Entity Attribute
    ...    id=${entity_id}
    ...    attr_id=speed
+50 −0
Changes for TP/NGSI-LD/ContextInformation/Consumption/EntityAttributes/RetrieveAttributeValue/062_06.robot: 50 added lines, 0 removed lines.
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that one can retrieve a LanguageProperty of an Entity: in the language the lang parameter selects, or whole when no lang is given

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

Suite Setup         Create Initial Entity
Suite Teardown      Delete Initial Entity
Test Template       Retrieve A LanguageProperty Of An Entity


*** Variables ***
${filename}=    building-language-property.jsonld


*** Test Cases ***    LANG    EXPECTATION_FILENAME
062_06_01 Retrieve A LanguageProperty In One Language
    [Tags]    since_ts104_v1.1.1    ea-retrieve    core_10_4_4    http_7_5_3_1
    fr    attribute-fragment-street-fr.json
062_06_02 Retrieve A LanguageProperty Without lang
    [Tags]    since_ts104_v1.1.1    ea-retrieve    core_10_4_4    http_7_5_3_1
    ${EMPTY}    attribute-fragment-street-languagemap.json


*** Keywords ***
Create Initial Entity
    ${entity_id}=    Generate Random Building Entity Id
    ${response}=    Create Entity Selecting Content Type
    ...    ${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}

Retrieve A LanguageProperty Of An Entity
    [Documentation]    Check that the lang parameter selects the language of the LanguageProperty returned
    [Arguments]    ${lang}    ${expectation_filename}

    ${response}=    Retrieve Entity Attribute
    ...    id=${entity_id}
    ...    attr_id=street
    ...    context=${ngsild_test_suite_context}
    ...    lang=${lang}
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Content    ${expectation_filename}    ${response.json()}
+54 −0
Changes for TP/NGSI-LD/ContextInformation/Consumption/EntityAttributes/RetrieveAttributeValue/062_07.robot: 54 added lines, 0 removed lines.
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that the type parameter of a Retrieve Attribute selects the Entity: an Entity of that type has its Attribute returned, an Entity of another type is not found (404)

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

Suite Setup         Create Initial Entity
Suite Teardown      Delete Initial Entity


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


*** Test Cases ***
062_07_01 Retrieve An Attribute Of An Entity Of The Type Given
    [Documentation]    Check that the Attribute is returned when the Entity has the type given
    [Tags]    since_ts104_v1.1.1    ea-retrieve    core_10_4_4    http_7_5_3_1
    ${response}=    Retrieve Entity Attribute
    ...    id=${entity_id}
    ...    attr_id=name
    ...    context=${ngsild_test_suite_context}
    ...    type=Building
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Content    attribute-fragment-name.json    ${response.json()}

062_07_02 Retrieve An Attribute Of An Entity Of Another Type
    [Documentation]    Check that the Entity is not found when it does not have the type given
    [Tags]    since_ts104_v1.1.1    ea-retrieve    core_10_4_4    http_7_5_3_1
    ${response}=    Retrieve Entity Attribute
    ...    id=${entity_id}
    ...    attr_id=name
    ...    context=${ngsild_test_suite_context}
    ...    type=Vehicle
    Check Response Status Code    404    ${response.status_code}
    Check Response Body Containing ProblemDetails Element Containing Type Element set to
    ...    ${response.json()}
    ...    ${ERROR_TYPE_RESOURCE_NOT_FOUND}


*** Keywords ***
Create Initial Entity
    ${entity_id}=    Generate Random Building Entity Id
    ${response}=    Create Entity Selecting Content Type
    ...    ${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}
Loading