Commit f5b0d8e3 authored by Houcem Kacem's avatar Houcem Kacem
Browse files

feat: add tps for context information consumption discovery

parent 9b35e446
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you cannot retrieve a detailed representation of an unknown NGSI-LD attribute
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup      Setup Initial Entities
Suite Teardown      Delete Initial Entities

*** Variable ***
${building_id_prefix}=  urn:ngsi-ld:Building:
${filename}=  building-simple-attributes-sample.json

*** Test Case ***
Retrieve Detailed Representation Of Available Attribute Without Context
    [Documentation]  Check that you cannot retrieve a detailed representation of an unknown NGSI-LD attribute
    [Tags]  mandatory

    Retrieve Attribute   attribute_name=airQualityLevel

    Check Response Status Code Set To  404
    Check Response Body Containing ProblemDetails Element Containing Type Element set to      ${response}     ${ERROR_TYPE_RESOURCE_NOT_FOUND}
    Check Response Body Containing ProblemDetails Element Containing Title Element    ${response}

*** Keywords ***
Setup Initial Entities
    ${entity_id}=     Generate Random Entity Id    ${building_id_prefix}

    Create Entity Selecting Content Type  ${filename}     ${entity_id}    ${CONTENT_TYPE_JSON}    ${ngsild_test_suite_context}

    Set Suite Variable  ${entity_id}

Delete Initial Entities
    Delete Entity by Id Returning Response   ${entity_id}
+34 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can retrieve a list with a detailed representation of NGSI-LD attributes
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup      Setup Initial Entities
Suite Teardown      Delete Initial Entities

*** Variable ***
${building_id_prefix}=  urn:ngsi-ld:Building:
${filename}=  building-simple-attributes-sample.json
${expectation_file}=  types/expectations/attribute-027-01-expectation.json

*** Test Case ***
Retrieve Detailed Representation Of Available Attribute
    [Documentation]  Check that you can retrieve a list with a detailed representation of NGSI-LD attributes
    [Tags]  mandatory

    Retrieve Attribute   attribute_name=airQualityLevel     context=${ngsild_test_suite_context}

    Check Response Status Code Set To  200
    Check Response Body Containing Attribute element   ${expectation_file}

*** Keywords ***
Setup Initial Entities
    ${entity_id}=     Generate Random Entity Id    ${building_id_prefix}

    Create Entity Selecting Content Type  ${filename}     ${entity_id}    ${CONTENT_TYPE_JSON}    ${ngsild_test_suite_context}

    Set Suite Variable  ${entity_id}

Delete Initial Entities
    Delete Entity by Id Returning Response   ${entity_id}
+38 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can retrieve a list of NGSI-LD attributes
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Test Template  Retrieve Available Attributes
Suite Setup      Setup Initial Entities
Suite Teardown      Delete Initial Entities

*** Variable ***
${building_id_prefix}=  urn:ngsi-ld:Building:
${filename}=  building-simple-attributes-sample.json

*** Test Cases ***          CONTEXT                         EXPECTATION_FILE
WithoutJsonLdContext        ${EMPTY}                        types/expectations/attribute-list-025-01-01-expectation.json
WithJsonLdContext           ${ngsild_test_suite_context}    types/expectations/attribute-list-025-01-02-expectation.json

*** Keywords ***
Retrieve Available Attributes
    [Arguments]  ${context}     ${expectation_file}
    [Documentation]  Check that you can retrieve a list of NGSI-LD attributes
    [Tags]  mandatory

    Retrieve Attributes   ${context}

    Check Response Status Code Set To  200
    Check Response Body Containing AttributeList element   ${expectation_file}

Setup Initial Entities
    ${entity_id}=     Generate Random Entity Id    ${building_id_prefix}

    Create Entity Selecting Content Type  ${filename}     ${entity_id}    ${CONTENT_TYPE_JSON}    ${ngsild_test_suite_context}

    Set Suite Variable  ${entity_id}

Delete Initial Entities
    Delete Entity by Id Returning Response   ${entity_id}
+38 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you cannot retrieve a detailed representation of an unknown NGSI-LD entity type
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup      Setup Initial Entities
Suite Teardown      Delete Initial Entities

*** Variable ***
${building_id_prefix}=  urn:ngsi-ld:Building:
${filename}=  building-simple-attributes-sample.json

*** Test Case ***
Retrieve Detailed Representation Of Available Entity Type Without Context
    [Documentation]  Check that you cannot retrieve a detailed representation of an unknown NGSI-LD entity type
    [Tags]  mandatory

    Retrieve Entity Type   type=Building

    Check Response Status Code Set To  404
    Check Response Body Containing ProblemDetails Element Containing Type Element set to      ${response}     ${ERROR_TYPE_RESOURCE_NOT_FOUND}
    Check Response Body Containing ProblemDetails Element Containing Title Element    ${response}

*** Keywords ***
Setup Initial Entities
    ${first_entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${second_entity_id}=     Generate Random Entity Id    ${building_id_prefix}

    Create Entity Selecting Content Type  ${filename}     ${first_entity_id}    ${CONTENT_TYPE_JSON}    ${ngsild_test_suite_context}
    Create Entity Selecting Content Type  ${filename}     ${second_entity_id}    ${CONTENT_TYPE_JSON}    ${ngsild_test_suite_context}

    Set Suite Variable  ${first_entity_id}
    Set Suite Variable  ${second_entity_id}

Delete Initial Entities
    Delete Entity by Id Returning Response   ${first_entity_id}
    Delete Entity by Id Returning Response   ${second_entity_id}
 No newline at end of file
+38 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can retrieve a detailed representation of a specified NGSI-LD entity type
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup      Setup Initial Entities
Suite Teardown      Delete Initial Entities

*** Variable ***
${building_id_prefix}=  urn:ngsi-ld:Building:
${filename}=  building-simple-attributes-sample.json
${expectation_file}=  types/expectations/entity-type-info-024-01-expectation.json

*** Test Case ***
Retrieve Detailed Representation Of Available Entity Type
    [Documentation]  Check that you can retrieve a detailed representation of a specified NGSI-LD entity type
    [Tags]  mandatory

    Retrieve Entity Type   type=Building    context=${ngsild_test_suite_context}

    Check Response Status Code Set To  200
    Check Response Body Containing EntityTypeInfo element   ${expectation_file}

*** Keywords ***
Setup Initial Entities
    ${first_entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${second_entity_id}=     Generate Random Entity Id    ${building_id_prefix}

    Create Entity Selecting Content Type  ${filename}     ${first_entity_id}    ${CONTENT_TYPE_JSON}    ${ngsild_test_suite_context}
    Create Entity Selecting Content Type  ${filename}     ${second_entity_id}    ${CONTENT_TYPE_JSON}    ${ngsild_test_suite_context}

    Set Suite Variable  ${first_entity_id}
    Set Suite Variable  ${second_entity_id}

Delete Initial Entities
    Delete Entity by Id Returning Response   ${first_entity_id}
    Delete Entity by Id Returning Response   ${second_entity_id}
 No newline at end of file
Loading