Commit 4c177598 authored by lopezaguilar's avatar lopezaguilar
Browse files

Resolution of automatic doc generation based on the modification of CSR robot files

parent eee1ce96
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ ${date_format_with_millis} %Y-%m-%dT%H:%M:%S.%f
*** Test Cases ***
046_07_01 Check notification structure
    [Documentation]    The structure of the notification message shall be as mandated by clause 5.3. Valid notification with attributes as stated above
    [Tags]    sub-notification    5_8_6    046_07_01
    [Tags]    sub-notification    5_8_6    046_07
    [Setup]    Setup Initial Subscriptions    ${subscription_payload_file_path}

    ${response}=    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
@@ -41,7 +41,7 @@ ${date_format_with_millis} %Y-%m-%dT%H:%M:%S.%f

046_07_02 Check correct attributes are included
    [Documentation]    The structure of the notification message shall be as mandated by clause 5.3.    The Entity Attributes included (Properties or Relationships) shall be those specified by the notification.attributes member in the Subscription data type (clause 5.2.12).
    [Tags]    sub-notification    5_8_6    046_07_02
    [Tags]    sub-notification    5_8_6    046_07
    [Setup]    Setup Initial Subscriptions    ${subscription_payload_file_path_notificationAttributes}

    ${response}=    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
@@ -56,7 +56,7 @@ ${date_format_with_millis} %Y-%m-%dT%H:%M:%S.%f

046_07_03 Check URI expansion is observed
    [Documentation]    The structure of the notification message shall be as mandated by clause 5.3.    URI expansion shall be observed (clause 5.5.7).
    [Tags]    sub-notification    5_8_6    046_07_03
    [Tags]    sub-notification    5_8_6    046_07
    [Setup]    Setup Initial Subscriptions    ${subscription_payload_file_path_default_context}

    ${response}=    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
+15 −1
Original line number Diff line number Diff line
@@ -97,7 +97,9 @@ class Checks:
            'Check Response Body Content':
                Checks.check_response_body_content,
            'Check Retrieving Context Source Registration':
                Checks.check_retrieving_context_source_registration
                Checks.check_retrieving_context_source_registration,
            'Check JSON Value Not In Response Body':
                Checks.check_json_value_not_in_response_body
        }

        self.args = {
@@ -278,6 +280,10 @@ class Checks:
            'Check Retrieving Context Source Registration': {
                'params': ['registration_id', 'context', 'accept', 'registration_payload'],
                'position': [0, 1, 2, 3]
            },
            'Check JSON Value Not In Response Body': {
                'params': ['json_path_expr'],
                'position': [0]
            }
        }

@@ -668,6 +674,14 @@ class Checks:
        else:
            raise Exception(f"ERROR, expected key and value attributes, but received: {kwargs}")

    @staticmethod
    def check_json_value_not_in_response_body(kwargs: list) -> str:
        if 'json_path_expr' in kwargs:
            key = kwargs['json_path_expr']
            return f"Check that response body does not contain the key '{key}'"
        else:
            raise Exception(f"ERROR, expected key and value attributes, but received: {kwargs}")

    @staticmethod
    def check_pagination_prev_and_next_headers(kwargs: list) -> str:
        previous = None
+20 −4
Original line number Diff line number Diff line
@@ -143,7 +143,7 @@ class Requests:
                'params': ['context', 'id', 'type', 'idPattern', 'attrs',
                           'q', 'csf', 'georel', 'geometry',
                           'coordinates', 'geoproperty', 'timeproperty', 'timerel',
                           'timeAt', 'limit', 'page', 'accept']
                           'timeAt', 'limit', 'offset', 'accept']
            },
            'Update Context Source Registration With Return': {
                'positions': [0, 1, 2],
@@ -173,6 +173,10 @@ class Requests:
                'positions': [0, 1],
                'params': ['context_source_registration_id', 'update_fragment']
            },
            'Update Context Source Registration From File': {
                'positions': [0, 1],
                'params': ['context_source_registration_id', 'filename']
            },
            'Update Context Source Registration Subscription From File': {
                'positions': [0, 1],
                'params': ['subscription_id', 'subscription_update_fragment']
@@ -310,6 +314,8 @@ class Requests:
                Requests.update_context_source_registration_with_return,
            'Update Context Source Registration':
                Requests.update_context_source_registration,
            'Update Context Source Registration From File':
                Requests.update_context_source_registration_from_file,
            'Retrieve context source registration subscription':
                Requests.retrieve_context_source_registration_subscription_2,
            'Create Context Source Registration Subscription':
@@ -1312,6 +1318,16 @@ class Requests:
            raise Exception(f"ERROR, expected 'context_source_registration_id' and 'update_fragment'"
                            f" but received: {kwargs}")

    @staticmethod
    def update_context_source_registration_from_file(kwargs) -> str:
        if 'context_source_registration_id' in kwargs and 'filename' in kwargs:
            return (f"Update Context Source Registration "
                    f"with CSR Id set to '{kwargs['context_source_registration_id']}' and "
                    f"subscription update from file '{kwargs['filename']}'")
        else:
            raise Exception(f"ERROR, expected 'context_source_registration_id' and 'update_fragment'"
                            f" but received: {kwargs}")

    @staticmethod
    def update_context_source_registration_subscription(kwargs) -> str:
        if 'subscription_id' in kwargs and 'subscription_update_fragment' in kwargs:
@@ -1356,7 +1372,7 @@ class Requests:
        expected_parameters = ['context', 'id', 'type', 'idPattern', 'attrs',
                               'q', 'csf', 'georel', 'geometry',
                               'coordinates', 'geoproperty', 'timeproperty', 'timerel',
                               'timeAt', 'limit', 'page', 'accept']
                               'timeAt', 'limit', 'offset', 'accept']

        # kwargs = {key: kwargs.get(key, '${EMPTY}') for key in expected_parameters}

@@ -1394,8 +1410,8 @@ class Requests:
                    response = f"{response} and\n    Query Parameter: timeAt set to '{value}'"
                case 'limit':
                    response = f"{response} and\n    Query Parameter: limit set to '{value}'"
                case 'page':
                    response = f"{response} and\n    Query Parameter: page set to '{value}'"
                case 'offset':
                    response = f"{response} and\n    Query Parameter: offset set to '{value}'"
                case 'accept':
                    response = f"{response} and\n    Query Parameter: accept set to '{value}'"
                # If an exact match is not confirmed, this last case will be used if provided
+5 −5
Original line number Diff line number Diff line
{
  "tp_id": "TP/NGSI-LD/CI/SUB/046_07",
  "test_objective": "Check that a notification is only sent if and only if the status is active",
  "reference": "ETSI GS CIM 009 V1.3.1 [], clause 046.07.01",
  "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6",
  "config_id": "",
  "parent_release": "v1.3.1",
  "pics_selection": "PICS_046_07_01",
  "pics_selection": "PICS_5_8_6",
  "keywords": [
    "Before Suite",
    "After Suite"
@@ -17,7 +17,7 @@
      "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_07_01",
      "doc": "The structure of the notification message shall be as mandated by clause 5.3. Valid notification with attributes as stated above",
      "tags": [
        "046_07_01",
        "046_07",
        "5_8_6",
        "sub-notification"
      ],
@@ -34,7 +34,7 @@
      "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_07_02",
      "doc": "The structure of the notification message shall be as mandated by clause 5.3.    The Entity Attributes included (Properties or Relationships) shall be those specified by the notification.attributes member in the Subscription data type (clause 5.2.12).",
      "tags": [
        "046_07_02",
        "046_07",
        "5_8_6",
        "sub-notification"
      ],
@@ -51,7 +51,7 @@
      "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_07_03",
      "doc": "The structure of the notification message shall be as mandated by clause 5.3.    URI expansion shall be observed (clause 5.5.7).",
      "tags": [
        "046_07_03",
        "046_07",
        "5_8_6",
        "sub-notification"
      ],
+5 −23
Original line number Diff line number Diff line
{
  "tp_id": "TP/NGSI-LD/CS/DISC/036_01",
  "test_objective": "Check that you cannot retrieve a Context Source Registration, if the context source registration id is not present or it is not a valid URI",
  "test_objective": "Check that you cannot retrieve a Context Source Registration, if the context source registration id is not a valid URI",
  "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.10.1",
  "config_id": "",
  "parent_release": "v1.3.1",
@@ -10,41 +10,23 @@
  "initial_condition": "with {\n   the SUT containing an initial state\n}",
  "test_cases": [
    {
      "name": "036_01_01 Not Present Id",
      "name": "036_01_01 Invalid Id",
      "permutation_tp_id": "TP/NGSI-LD/CS/DISC/036_01_01",
      "doc": "Check that you cannot retrieve a Context Source Registration, if the context source registration id is not present or it is not a valid URI",
      "doc": "Check that you cannot retrieve a Context Source Registration, if the context source registration id is not a valid URI",
      "tags": [
        "5_10_1",
        "csr-retrieve"
      ],
      "setup": null,
      "teardown": null,
      "template": "Retrieve Context Source Registration With A Not Present Or Invalid Id",
      "then": "then {\n    the SUT sends a valid Response for the operations:\n        Retrieve Context Source Registration with Response Status Code set to 400     and\n        Retrieve Context Source Registration with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData'     and\n        Retrieve Context Source Registration with Response body containing 'title' element\n}",
      "when": "when {\n    the SUT receives a Request from the client containing:\n        URL set to '/ngsi-ld/v1/csourceRegistrations/{context_source_registration_id}'\n        method set to 'GET'\n        Retrieve Context Source Registration with data: and\n    Query Parameter: context source registration id set to '${EMPTY}'\n}",
      "http_verb": "GET",
      "endpoint": "csourceRegistrations/{context_source_registration_id}"
    },
    {
      "name": "036_01_02 Invalid Id",
      "permutation_tp_id": "TP/NGSI-LD/CS/DISC/036_01_02",
      "doc": "Check that you cannot retrieve a Context Source Registration, if the context source registration id is not present or it is not a valid URI",
      "tags": [
        "5_10_1",
        "csr-retrieve"
      ],
      "setup": null,
      "teardown": null,
      "template": "Retrieve Context Source Registration With A Not Present Or Invalid Id",
      "template": "Retrieve Context Source Registration With An Invalid Id",
      "then": "then {\n    the SUT sends a valid Response for the operations:\n        Retrieve Context Source Registration with Response Status Code set to 400     and\n        Retrieve Context Source Registration with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData'     and\n        Retrieve Context Source Registration with Response body containing 'title' element\n}",
      "when": "when {\n    the SUT receives a Request from the client containing:\n        URL set to '/ngsi-ld/v1/csourceRegistrations/{context_source_registration_id}'\n        method set to 'GET'\n        Retrieve Context Source Registration with data: and\n    Query Parameter: context source registration id set to 'invalidUri'\n}",
      "http_verb": "GET",
      "endpoint": "csourceRegistrations/{context_source_registration_id}"
    }
  ],
  "permutations": [
    "when"
  ],
  "permutations": [],
  "robotpath": "ContextSource/Discovery/RetrieveContextSourceRegistration",
  "robotfile": "036_01"
}
 No newline at end of file
Loading