feat(discovery): add TC for Retrieve Context Source Identity (064_01)

A new Test Case for Retrieve Context Source Identity Information, GET /info/sourceIdentity (TS 104-176 12.2.3.1, TS 104-175 15.2). Until now the suite did not test this operation.

  • 064_01: 200, and a body that is a ContextSourceIdentity element (TS 104-175 5.2.6.5.6). id is a URI, type is ContextSourceIdentity, contextSourceAlias is not empty, contextSourceUptime is an ISO 8601 duration and contextSourceTimeAt is a DateTime.

1 Test Case in TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceIdentity/, plus:

  • the keyword Retrieve Context Source Identity (resources/ApiUtils/ContextSourceDiscovery.resource)
  • the check Check Response Body Containing ContextSourceIdentity element (resources/AssertionUtils.resource)
  • the documentation-generator entries (doc/analysis/)

Measured with scripts/api_coverage (!326 (merged)) against develop: operations 50 -> 51, status codes 135 -> 136 (GET info/sourceIdentity: the operation and 200).

It passes against a broker. The dry run, robocop format --check and the documentation generator are clean.

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

Merge request reports

Loading
+14 −0
Changes for TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceIdentity/064_01.robot: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that one can retrieve the identity of the Context Source: a ContextSourceIdentity

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


*** Test Cases ***
064_01_01 Retrieve The Context Source Identity
    [Documentation]    Check that the Context Source identity can be retrieved
    [Tags]    csi-retrieve    core_15_2    core_5_2_6_5_6    http_12_2_3_1
    ${response}=    Retrieve Context Source Identity
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing ContextSourceIdentity element    ${response.json()}
+13 −0
Changes for doc/analysis/checks.py: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ class Checks:
                Checks.check_response_body_containing_context_source_registration_element,
            'Check Response Body Containing EntityTypeList element':
                Checks.check_response_body_containing_entitytypelist_element,
            'Check Response Body Containing ContextSourceIdentity element':
                Checks.check_response_body_containing_contextsourceidentity_element,
            'Check Response Body Containing EntityType element':
                Checks.check_response_body_containing_entitytype_element,
            'Check Response Body Containing EntityTypeInfo element':
@@ -257,6 +259,10 @@ class Checks:
                'params': ['filename', 'response'],
                'position': [0, 1]
            },
            'Check Response Body Containing ContextSourceIdentity element': {
                'params': ['response_body'],
                'position': [0]
            },
            'Check Response Body Containing EntityType element': {
                'params': ['filename', 'response'],
                'position': [0, 1]
@@ -833,6 +839,13 @@ class Checks:
        else:
            raise Exception(f"ERROR, expected filename and response attributes, but received: {kwargs}")

    @staticmethod
    def check_response_body_containing_contextsourceidentity_element(kwargs: list) -> str:
        if 'response_body' in kwargs:
            return "Response Body containing a ContextSourceIdentity element"
        else:
            raise Exception(f"ERROR, expected response_body attribute, but received: {kwargs}")

    @staticmethod
    def check_response_body_containing_entitytype_element(kwargs: list) -> str:
        if 'filename' in kwargs and 'response' in kwargs:
+1 −0
Changes for doc/analysis/generaterobotdata.py: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ class GenerateRobotData:
            'RegistrationSubscription/CSRegistrationSubscriptionNotificationBehaviour': 'REGSUB',
            'RegistrationSUBBehaviour': 'REGSUB',
            'Discovery/RetrieveCSRegistration': 'DISC',
            'Discovery/RetrieveCSIdentity': 'DISC',
            'Discovery/QueryCSRegistrations': 'DISC',
            'CommonResponses/VerifyLdContextNotAvailable': 'HTTP',
            'CommonResponses/VerifyMergePatchJson': 'HTTP',
+10 −0
Changes for doc/analysis/requests.py: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -90,6 +90,10 @@ class Requests:
                'positions': [0],
                'params': ['attribute_name']
            },
            'Retrieve Context Source Identity': {
                'positions': [],
                'params': []
            },
            'Retrieve Entity Attribute': {
                'positions': [],
                'params': ['id', 'attr_id', 'context', 'datasetId', 'lang', 'type']
@@ -347,6 +351,8 @@ class Requests:
                Requests.append_entity_attributes_with_parameters,
            'Retrieve Attribute':
                Requests.retrieve_attribute,
            'Retrieve Context Source Identity':
                Requests.retrieve_context_source_identity,
            'Retrieve Entity Attribute':
                Requests.retrieve_entity_attribute,
            'Retrieve Entity Type':
@@ -1353,6 +1359,10 @@ class Requests:

        return response

    @staticmethod
    def retrieve_context_source_identity(kwargs) -> str:
        return "Retrieve Context Source Identity"

    @staticmethod
    def entity_attribute_description(title, kwargs) -> str:
        response = f"{title}:"
+10 −0
Changes for resources/ApiUtils/ContextSourceDiscovery.resource: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -162,3 +162,13 @@ Retrieve Context Source Registration
    ...    expected_status=any
    Output    ${response}    Retrieve Context Source Registration
    RETURN    ${response}

Retrieve Context Source Identity
    [Documentation]    GET /info/sourceIdentity
    [Tags]    actor_context-consumer

    ${response}=    GET
    ...    url=${url}${NGSI_LD_API_PATH}/info/sourceIdentity
    ...    expected_status=any
    Output    ${response}    Retrieve Context Source Identity
    RETURN    ${response}
Loading
Loading