Commit 20f84d79 authored by Houcem Kacem's avatar Houcem Kacem
Browse files

fix: fix upsert batch of entities failure tests

parent 23f7c257
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can update 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

Suite Setup      Setup Initial Entities

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

*** Test Case ***
Update a batch of entities
    [Documentation]  Check that you can update a batch of entities
    [Tags]  critical

    ${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_upserted}=  Create List   ${first_entity}     ${second_entity}

    Batch Upsert Entities   @{entities_to_be_upserted}

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

    #TODO call Batch Delete Entities
    Delete Entity by Id  ${new_entity_id}
    Delete Entity by Id  ${first_existing_entity_id}
    Delete Entity by Id  ${second_existing_entity_id}

*** 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  building-minimal-sample.jsonld     ${first_entity_id}
    Create Entity  building-minimal-sample.jsonld     ${second_entity_id}

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