Feature: misc refactorings and improvements

Merge request reports

Loading
+36 −0
Changes for TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_01.robot: 36 added lines, 0 removed lines.
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can create a batch of entities
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Test Template  Batch Create Entity Scenarios

*** Variable ***
${building_id_prefix}=  urn:ngsi-ld:Building:

*** Test Cases ***                        FILENAME
MinimalEntity                             building-minimal-sample.jsonld
EntityWithSimpleProperties                building-simple-attributes-sample.jsonld
EntityWithSimpleRelationships             building-relationship-sample.jsonld
EntityWithRelationshipsProperties         building-relationship-of-property-sample.jsonld

*** Keywords ***
Batch Create Entity Scenarios
    [Arguments]  ${filename}
    [Documentation]  Check that you can create a batch of entities
    [Tags]  mandatory   entityOperations

    ${first_entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${second_entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${first_entity}=    Load Entity    ${filename}      ${first_entity_id}
    ${second_entity}=    Load Entity    ${filename}      ${second_entity_id}
    @{entities_to_be_created}=  Create List   ${first_entity}     ${second_entity}

    Batch Create Entities   @{entities_to_be_created}

    @{expected_entities_ids}=  Create List   ${first_entity_id}     ${second_entity_id}
    Check Response Status Code Set To  201
    Check Response Body Containing Array Of URIs set to   @{expected_entities_ids}

    Batch Delete Entities       @{expected_entities_ids}
+4 −12
Changes for TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_02.robot: 4 added lines, 12 removed lines.
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can create a batch of entities where some will succeed and others will fail
Variables   ../../../../../../resources/variables.py
Resource    ../../../../../../resources/ApiUtils.resource
Resource    ../../../../../../resources/AssertionUtils.resource
Resource    ../../../../../../resources/JsonUtils.resource
Library     REST    ${url}
Library     JSONLibrary
Library     String
Library     Collections
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup      Setup Initial Entities

*** Variable ***
${batch_endpoint}=    entityOperations/create
${batch_delete_endpoint}=    entityOperations/delete
${endpoint}=    entities
${building_id_prefix}=  urn:ngsi-ld:Building:

*** Test Case ***
Create a batch of two valid entities and one invalid entity
    [Documentation]  Check that you can create a batch of two valid entities and one invalid entity
    [Tags]  critical
    [Tags]  mandatory

    ${first_entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${second_entity_id}=     Generate Random Entity Id    ${building_id_prefix}
+21 −0
Changes for TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot: 21 added lines, 0 removed lines.
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you cannot create a batch of entities with an invalid request
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource

Test Template  Create Batch Entity With Invalid Request Scenarios

*** Test Cases ***                        FILENAME
InvalidJson                               batch/invalid-json-sample.jsonld
EmptyJson                                 batch/empty-sample.jsonld

*** Keywords ***
Create Batch Entity With Invalid Request Scenarios
    [Arguments]  ${filename}
    [Documentation]  Check that you cannot create a batch of entities with an invalid request
    [Tags]  mandatory

    Batch Request Entities From File   create   filename=${filename}

    Check RL Response Status Code Set To  400
    Check RL Response Body Containing Problem Details Element Containing Detail Element    ${response}
+0 −32
Changes for TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/failure.robot: 0 added lines, 32 removed lines.
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you cannot create a batch of entities with an invalid request
Variables   ../../../../../../resources/variables.py
Resource    ../../../../../../resources/ApiUtils.resource
Resource    ../../../../../../resources/AssertionUtils.resource
Library     RequestsLibrary
Library     JSONLibrary
Library     OperatingSystem


*** Variable ***
${batch_endpoint}=    entityOperations/create
${endpoint}=    entities

*** Test Case ***
With invalid json document
    [Documentation]  Check that you cannot create a batch of entities with an invalid json document
    [Tags]  critical

    Batch Request Entities From File   batch/invalid-json-sample.jsonld

    Check Response Status Code Set To  400
    Check Response Body Containing Problem Details Element Containing Detail Element    ${response}

With empty json document
    [Documentation]  Check that you cannot create a batch of entities with an empty json document
    [Tags]  critical

    Batch Request Entities From File   batch/empty-sample.jsonld

    Check Response Status Code Set To  400
    Check Response Body Containing Problem Details Element Containing Detail Element    ${response}
+0 −71
Changes for TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot: 0 added lines, 71 removed lines.
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can create a batch of entities
Variables   ../../../../../../resources/variables.py
Resource    ../../../../../../resources/ApiUtils.resource
Resource    ../../../../../../resources/AssertionUtils.resource
Resource    ../../../../../../resources/JsonUtils.resource
Library     REST    ${url}
Library     JSONLibrary
Library     String
Library     Collections

*** Variable ***
${batch_endpoint}=    entityOperations/create
${batch_delete_endpoint}=    entityOperations/delete
${endpoint}=    entities
${building_id_prefix}=  urn:ngsi-ld:Building:

*** Test Case ***
Create a batch of minimal entities
    [Documentation]  Check that you can create a batch of minimal entities
    [Tags]  critical

    ${first_entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${second_entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${first_entity}=    Load Entity    building-minimal-sample.jsonld      ${first_entity_id}
    ${second_entity}=    Load Entity    building-minimal-sample.jsonld      ${second_entity_id}
    @{entities_to_be_created}=  Create List   ${first_entity}     ${second_entity}

    Batch Create Entities   @{entities_to_be_created}

    @{expected_entities_ids}=  Create List   ${first_entity_id}     ${second_entity_id}
    Check Response Status Code Set To  201
    Check Response Body Containing Array Of URIs set to   @{expected_entities_ids}

    Batch Delete Entities       @{expected_entities_ids}

Create a batch of entities having only simple properties
    [Documentation]  Check that you can create a batch of entities having only simple properties
    [Tags]  critical

    ${first_entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${second_entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${first_entity}=    Load Entity    building-simple-attributes-sample.jsonld      ${first_entity_id}
    ${second_entity}=    Load Entity    building-simple-attributes-sample.jsonld      ${second_entity_id}
    @{entities_to_be_created}=  Create List   ${first_entity}     ${second_entity}

    Batch Create Entities   @{entities_to_be_created}

    @{expected_entities_ids}=  Create List   ${first_entity_id}     ${second_entity_id}
    Check Response Status Code Set To  201
    Check Response Body Containing Array Of URIs set to  @{expected_entities_ids}

    Batch Delete Entities       @{expected_entities_ids}

Create a batch of entities having multiple attributes
    [Documentation]  Check that you can create a batch of entities having multiple attributes
    [Tags]  critical

    ${first_entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${second_entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${first_entity}=    Load Entity    building-relationship-of-property-sample.jsonld      ${first_entity_id}
    ${second_entity}=    Load Entity    building-relationship-of-property-sample.jsonld      ${second_entity_id}
    @{entities_to_be_created}=  Create List   ${first_entity}     ${second_entity}

    Batch Create Entities   @{entities_to_be_created}

    @{expected_entities_ids}=  Create List   ${first_entity_id}     ${second_entity_id}
    Check Response Status Code Set To  201
    Check Response Body Containing Array Of URIs set to  @{expected_entities_ids}

    Batch Delete Entities       @{expected_entities_ids}
Loading
Loading