Commit f102c281 authored by lopesg's avatar lopesg
Browse files

common behaviours

parent a50ef884
Loading
Loading
Loading
Loading
+19 −11
Original line number Diff line number Diff line
@@ -4,25 +4,33 @@ Resource ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Test Template  Get Entity With Invalid/Missing Id
Test Template  Throw 503 LDContextNotAvaliable error 

*** Variable ***
${expected_status_code}=  503
${building_id_prefix}=  urn:ngsi-ld:Building:
${registration_id_prefix}=  urn:ngsi-ld:Registration:
${subscription_id_prefix}=  urn:ngsi-ld:Subscription:

*** Test Cases ***                              ENDPOINT                                                              FILENAME_PATH
043_01_endpoint /entities/                      ${ENTITIES_ENDPOINT_PATH}                                             entities/building-minimal-without-context-sample.jsonld
#043_02_endpoint /csourceRegistrations/          ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}                          csourceRegistrations/context-source-registration-without-context-sample.jsonld                         
#043_03_endpoint /subscriptions/                 ${SUBSCRIPTION_ENDPOINT_PATH}                                         csourceSubscriptions/subscription-without-context-sample.jsonld
#043_04_endpoint /csourceSubscriptions/          ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH}             csourceSubscriptions/subscription-without-context-sample.jsonld
#043_05_endpoint /temporal/entities/             ${TEMPORAL_ENTITIES_ENDPOINT_PATH}                                    temporalEntities/bus-temporal-representation-without-context-sample.jsonld
*** Test Cases ***                          PREFIX                              DELETE_PREFIX             ENDPOINT                                                              FILENAME_PATH                                                                           
043_01_endpoint /entities/                  ${building_id_prefix}               ${EMPTY}                  ${ENTITIES_ENDPOINT_PATH}                                             entities/building-minimal-without-context-sample.jsonld 
043_02_endpoint /csourceRegistrations/      ${registration_id_prefix}           ${EMPTY}                  ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}                          csourceRegistrations/context-source-registration-without-context-sample.jsonld                         
043_03_endpoint /subscriptions/             ${subscription_id_prefix}           ${EMPTY}                  ${SUBSCRIPTION_ENDPOINT_PATH}                                         csourceSubscriptions/subscription-without-context-sample.jsonld
043_04_endpoint /csourceSubscriptions/      ${subscription_id_prefix}           /                         ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH}             csourceSubscriptions/subscription-without-context-sample.jsonld
043_05_endpoint /temporal/entities/         ${building_id_prefix}               /                         ${TEMPORAL_ENTITIES_ENDPOINT_PATH}                                    temporalEntities/bus-temporal-representation-without-context-sample.jsonld

*** Keywords ***                               
Get Entity With Invalid/Missing Id
    [Arguments]  ${endpoint}     ${filename_path}
Throw 503 LDContextNotAvaliable error 
    [Arguments]  ${prefix}     ${delete_prefix}     ${endpoint}     ${filename_path}
    [Documentation]  Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved 
    [Tags]  mandatory

    ${response}=    Create Request By Selecting Endpoint    ${endpoint}    ${filename_path}
    ${create_id}=       Generate Random Entity Id    ${prefix}    
    ${delete_id}=       Set Variable    ${delete_prefix}${create_id}  

    ${response}=    Create Request By Selecting Endpoint    ${create_id}    ${endpoint}    ${filename_path}
    Check Response Status Code  ${expected_status_code}    ${response['status']}
    Check Response Body Containing ProblemDetails Element Containing Type Element set to      ${response}     ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE}
    Check Response Body Containing ProblemDetails Element Containing Title Element    ${response}
    
    [Teardown]  Delete Request By Selecting Endpoint/Id  ${delete_id}    ${endpoint}
 No newline at end of file
+47 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type 
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup    Generate Random Ids
Test Template  Throw 503 LDContextNotAvaliable error 

*** Variable ***
${expected_status_code}=  503
${building_id_prefix}=  urn:ngsi-ld:Building:
${registration_id_prefix}=  urn:ngsi-ld:Registration:
${subscription_id_prefix}=  urn:ngsi-ld:Subscription:

*** Test Cases ***                                                                ID                              DELETE_ID                         ENDPOINT                                                              FILENAME_PATH                                                                           
044_01_01_endpoint /entities/{entityId}/attrs/                                    ${entity_id}                    ${entity_id}                      ${ENTITIES_ENDPOINT_PATH}{entityId}/attrs/                                             entities/building-minimal-without-context-sample.jsonld 
044_01_02_endpoint /entities/{entityId}/attrs/{attrId}                            ${csourceRegistration_id}       ${csourceRegistration_id}         /entities/{entityId}/attrs/{attrId}                          csourceRegistrations/context-source-registration-without-context-sample.jsonld                         
044_01_03_endpoint /subscriptions/{subscriptionId}                                ${subscription_id}              ${subscription_id}                /subscriptions/{subscriptionId}                                        csourceSubscriptions/subscription-without-context-sample.jsonld
044_01_04_endpoint /csourceRegistrations/{registrationId}                         ${csourceSubscription_id}       ${csourceSubscription_id}        /csourceRegistrations/{registrationId}             csourceSubscriptions/subscription-without-context-sample.jsonld
044_01_05_endpoint /csourceSubscriptions/{subscriptionId}                         ${temporal_entity_id}           ${temporal_entity_id}            /csourceSubscriptions/{subscriptionId}                                    temporalEntities/bus-temporal-representation-without-context-sample.jsonld
044_01_06_endpoint /temporal/entities/{entityId}/attrs/{attrId}/{instanceId}                                                                        /temporal/entities/{entityId}/attrs/{attrId}/{instanceId}

*** Keywords ***                               
PATCH HTTP requests via "application/merge-patch+json"
    [Arguments]  ${id}     ${delete_id}     ${endpoint}     ${filename_path}
    [Documentation]  Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type 
    [Tags]  mandatory

    ${response}=    Merge Request By Selecting Endpoint    ${id}    ${endpoint}    ${filename_path}
    Check Response Status Code  ${expected_status_code}    ${response['status']}
    Check Response Body Containing ProblemDetails Element Containing Type Element set to      ${response}     ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE}
    Check Response Body Containing ProblemDetails Element Containing Title Element    ${response}
    
    [Teardown]  Delete Request By Selecting Endpoint/Id  ${delete_id}    ${endpoint}

Generate Random Ids
    ${entity_id}=       Generate Random Entity Id    ${building_id_prefix}
    ${temporal_entity_id}=       Generate Random Entity Id    ${building_id_prefix}
    ${csourceRegistration_id}=       Generate Random Entity Id    ${registration_id_prefix}
    ${csourceSubscription_id}=       Generate Random Entity Id    ${subscription_id_prefix}
    ${subscription_id}=       Generate Random Entity Id    ${subscription_id_prefix}
    Set Suite Variable  ${entity_id}
    Set Suite Variable  ${temporal_entity_id}
    Set Suite Variable  ${csourceRegistration_id}
    Set Suite Variable  ${csourceSubscription_id}
    Set Suite Variable  ${subscription_id}
 No newline at end of file
+46 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved 
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup    Generate Random Ids
Test Template  Throw 503 LDContextNotAvaliable error 

*** Variable ***
${expected_status_code}=  503
${building_id_prefix}=  urn:ngsi-ld:Building:
${registration_id_prefix}=  urn:ngsi-ld:Registration:
${subscription_id_prefix}=  urn:ngsi-ld:Subscription:

*** Test Cases ***                          ID                              DELETE_ID                         ENDPOINT                                                              FILENAME_PATH                                                                           
043_01_endpoint /entities/                  ${entity_id}                    ${entity_id}                      ${ENTITIES_ENDPOINT_PATH}                                             entities/building-minimal-without-context-sample.jsonld 
043_02_endpoint /csourceRegistrations/      ${csourceRegistration_id}       ${csourceRegistration_id}         ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}                          csourceRegistrations/context-source-registration-without-context-sample.jsonld                         
043_03_endpoint /subscriptions/             ${subscription_id}              ${subscription_id}                ${SUBSCRIPTION_ENDPOINT_PATH}                                         csourceSubscriptions/subscription-without-context-sample.jsonld
043_04_endpoint /csourceSubscriptions/      ${csourceSubscription_id}       /${csourceSubscription_id}        ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH}             csourceSubscriptions/subscription-without-context-sample.jsonld
043_05_endpoint /temporal/entities/         ${temporal_entity_id}           /${temporal_entity_id}            ${TEMPORAL_ENTITIES_ENDPOINT_PATH}                                    temporalEntities/bus-temporal-representation-without-context-sample.jsonld

*** Keywords ***                               
Throw 503 LDContextNotAvaliable error 
    [Arguments]  ${id}     ${delete_id}     ${endpoint}     ${filename_path}
    [Documentation]  Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved 
    [Tags]  mandatory

    ${response}=    Create Request By Selecting Endpoint    ${id}    ${endpoint}    ${filename_path}
    Check Response Status Code  ${expected_status_code}    ${response['status']}
    Check Response Body Containing ProblemDetails Element Containing Type Element set to      ${response}     ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE}
    Check Response Body Containing ProblemDetails Element Containing Title Element    ${response}
    
    [Teardown]  Delete Request By Selecting Endpoint/Id  ${delete_id}    ${endpoint}

Generate Random Ids
    ${entity_id}=       Generate Random Entity Id    ${building_id_prefix}
    ${temporal_entity_id}=       Generate Random Entity Id    ${building_id_prefix}
    ${csourceRegistration_id}=       Generate Random Entity Id    ${registration_id_prefix}
    ${csourceSubscription_id}=       Generate Random Entity Id    ${subscription_id_prefix}
    ${subscription_id}=       Generate Random Entity Id    ${subscription_id_prefix}
    Set Suite Variable  ${entity_id}
    Set Suite Variable  ${temporal_entity_id}
    Set Suite Variable  ${csourceRegistration_id}
    Set Suite Variable  ${csourceSubscription_id}
    Set Suite Variable  ${subscription_id}
 No newline at end of file
+46 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved 
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup    Generate Random Ids
Test Template  Throw 503 LDContextNotAvaliable error 

*** Variable ***
${expected_status_code}=  503
${building_id_prefix}=  urn:ngsi-ld:Building:
${registration_id_prefix}=  urn:ngsi-ld:Registration:
${subscription_id_prefix}=  urn:ngsi-ld:Subscription:

*** Test Cases ***                          ID                              DELETE_ID                         ENDPOINT                                                              FILENAME_PATH                                                                           
043_01_endpoint /entities/                  ${entity_id}                    ${entity_id}                      ${ENTITIES_ENDPOINT_PATH}                                             entities/building-minimal-without-context-sample.jsonld 
043_02_endpoint /csourceRegistrations/      ${csourceRegistration_id}       ${csourceRegistration_id}         ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}                          csourceRegistrations/context-source-registration-without-context-sample.jsonld                         
043_03_endpoint /subscriptions/             ${subscription_id}              ${subscription_id}                ${SUBSCRIPTION_ENDPOINT_PATH}                                         csourceSubscriptions/subscription-without-context-sample.jsonld
043_04_endpoint /csourceSubscriptions/      ${csourceSubscription_id}       /${csourceSubscription_id}        ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH}             csourceSubscriptions/subscription-without-context-sample.jsonld
043_05_endpoint /temporal/entities/         ${temporal_entity_id}           /${temporal_entity_id}            ${TEMPORAL_ENTITIES_ENDPOINT_PATH}                                    temporalEntities/bus-temporal-representation-without-context-sample.jsonld

*** Keywords ***                               
Throw 503 LDContextNotAvaliable error 
    [Arguments]  ${id}     ${delete_id}     ${endpoint}     ${filename_path}
    [Documentation]  Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved 
    [Tags]  mandatory

    ${response}=    Create Request By Selecting Endpoint    ${id}    ${endpoint}    ${filename_path}
    Check Response Status Code  ${expected_status_code}    ${response['status']}
    Check Response Body Containing ProblemDetails Element Containing Type Element set to      ${response}     ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE}
    Check Response Body Containing ProblemDetails Element Containing Title Element    ${response}
    
    [Teardown]  Delete Request By Selecting Endpoint/Id  ${delete_id}    ${endpoint}

Generate Random Ids
    ${entity_id}=       Generate Random Entity Id    ${building_id_prefix}
    ${temporal_entity_id}=       Generate Random Entity Id    ${building_id_prefix}
    ${csourceRegistration_id}=       Generate Random Entity Id    ${registration_id_prefix}
    ${csourceSubscription_id}=       Generate Random Entity Id    ${subscription_id_prefix}
    ${subscription_id}=       Generate Random Entity Id    ${subscription_id_prefix}
    Set Suite Variable  ${entity_id}
    Set Suite Variable  ${temporal_entity_id}
    Set Suite Variable  ${csourceRegistration_id}
    Set Suite Variable  ${csourceSubscription_id}
    Set Suite Variable  ${subscription_id}
 No newline at end of file
+46 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved 
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup    Generate Random Ids
Test Template  Throw 503 LDContextNotAvaliable error 

*** Variable ***
${expected_status_code}=  503
${building_id_prefix}=  urn:ngsi-ld:Building:
${registration_id_prefix}=  urn:ngsi-ld:Registration:
${subscription_id_prefix}=  urn:ngsi-ld:Subscription:

*** Test Cases ***                          ID                              DELETE_ID                         ENDPOINT                                                              FILENAME_PATH                                                                           
043_01_endpoint /entities/                  ${entity_id}                    ${entity_id}                      ${ENTITIES_ENDPOINT_PATH}                                             entities/building-minimal-without-context-sample.jsonld 
043_02_endpoint /csourceRegistrations/      ${csourceRegistration_id}       ${csourceRegistration_id}         ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}                          csourceRegistrations/context-source-registration-without-context-sample.jsonld                         
043_03_endpoint /subscriptions/             ${subscription_id}              ${subscription_id}                ${SUBSCRIPTION_ENDPOINT_PATH}                                         csourceSubscriptions/subscription-without-context-sample.jsonld
043_04_endpoint /csourceSubscriptions/      ${csourceSubscription_id}       /${csourceSubscription_id}        ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH}             csourceSubscriptions/subscription-without-context-sample.jsonld
043_05_endpoint /temporal/entities/         ${temporal_entity_id}           /${temporal_entity_id}            ${TEMPORAL_ENTITIES_ENDPOINT_PATH}                                    temporalEntities/bus-temporal-representation-without-context-sample.jsonld

*** Keywords ***                               
Throw 503 LDContextNotAvaliable error 
    [Arguments]  ${id}     ${delete_id}     ${endpoint}     ${filename_path}
    [Documentation]  Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved 
    [Tags]  mandatory

    ${response}=    Create Request By Selecting Endpoint    ${id}    ${endpoint}    ${filename_path}
    Check Response Status Code  ${expected_status_code}    ${response['status']}
    Check Response Body Containing ProblemDetails Element Containing Type Element set to      ${response}     ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE}
    Check Response Body Containing ProblemDetails Element Containing Title Element    ${response}
    
    [Teardown]  Delete Request By Selecting Endpoint/Id  ${delete_id}    ${endpoint}

Generate Random Ids
    ${entity_id}=       Generate Random Entity Id    ${building_id_prefix}
    ${temporal_entity_id}=       Generate Random Entity Id    ${building_id_prefix}
    ${csourceRegistration_id}=       Generate Random Entity Id    ${registration_id_prefix}
    ${csourceSubscription_id}=       Generate Random Entity Id    ${subscription_id_prefix}
    ${subscription_id}=       Generate Random Entity Id    ${subscription_id_prefix}
    Set Suite Variable  ${entity_id}
    Set Suite Variable  ${temporal_entity_id}
    Set Suite Variable  ${csourceRegistration_id}
    Set Suite Variable  ${csourceSubscription_id}
    Set Suite Variable  ${subscription_id}
 No newline at end of file
Loading