Commit 8a78d3f7 authored by Houcem Kacem's avatar Houcem Kacem
Browse files

feat: add other scenarios for batch create entities full success

parent 6e0036a7
Loading
Loading
Loading
Loading
+53 −5
Original line number Diff line number Diff line
@@ -13,19 +13,62 @@ ${batch_endpoint}= entityOperations/create
${endpoint}=    entities

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

    ${first_minimal_entity}=    Get File    ${EXECDIR}/data/building-minimal.jsonld
    ${second_minimal_entity}=    Get File    ${EXECDIR}/data/building-minimal-2.jsonld
    ${first_minimal_entity_parsed}=    evaluate    json.loads($first_minimal_entity)    json
    ${second_minimal_entity_parsed}=    evaluate    json.loads($second_minimal_entity)    json

    @{entities_to_be_created}=  Create List   ${first_minimal_entity_parsed}     ${second_minimal_entity_parsed}

    Batch Create Entities   @{entities_to_be_created}

    Check HTTP Status Code Is  201
    @{expected_entities_ids}=  Create List   urn:ngsi-ld:Building:3009ef20-9f62-41f5-bd66-92f041b428b9     urn:ngsi-ld:Building:56hy789-eft6-9987-be54-adr45nf567ddz
    Check Response Status Code Set To  201
    Check Response Body Set To  @{expected_entities_ids}

    #TODO call Batch Delete Entities
    Delete Entity by Id  urn:ngsi-ld:Building:3009ef20-9f62-41f5-bd66-92f041b428b9
    Delete Entity by Id  urn:ngsi-ld:Building:56hy789-eft6-9987-be54-adr45nf567ddz

Create 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}=    Get File    ${EXECDIR}/data/building-simple-attributes.jsonld
    ${second_entity}=    Get File    ${EXECDIR}/data/building-simple-attributes-2.jsonld
    ${first_entity_parsed}=    evaluate    json.loads($first_entity)    json
    ${second_entity_parsed}=    evaluate    json.loads($second_entity)    json
    @{entities_to_be_created}=  Create List   ${first_entity_parsed}     ${second_entity_parsed}

    Batch Create Entities   @{entities_to_be_created}

    @{expected_entities_ids}=  Create List   urn:ngsi-ld:Building:3009ef20-9f62-41f5-bd66-92f041b428b9     urn:ngsi-ld:Building:56hy789-eft6-9987-be54-adr45nf567ddz
    Check Response Status Code Set To  201
    Check Response Body Set To  @{expected_entities_ids}

    #TODO call Batch Delete Entities
    Delete Entity by Id  urn:ngsi-ld:Building:3009ef20-9f62-41f5-bd66-92f041b428b9
    Delete Entity by Id  urn:ngsi-ld:Building:56hy789-eft6-9987-be54-adr45nf567ddz

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

    ${first_entity}=    Get File    ${EXECDIR}/data/building-relationship-of-property.jsonld
    ${second_entity}=    Get File    ${EXECDIR}/data/building-relationship-of-property-2.jsonld
    ${first_entity_parsed}=    evaluate    json.loads($first_entity)    json
    ${second_entity_parsed}=    evaluate    json.loads($second_entity)    json
    @{entities_to_be_created}=  Create List   ${first_entity_parsed}     ${second_entity_parsed}

    Batch Create Entities   @{entities_to_be_created}

    @{expected_entities_ids}=  Create List   urn:ngsi-ld:Building:3009ef20-9f62-41f5-bd66-92f041b428b9     urn:ngsi-ld:Building:56hy789-eft6-9987-be54-adr45nf567ddz
    Check Response Status Code Set To  201
    Check Response Body Set To  @{expected_entities_ids}

    #TODO call Batch Delete Entities
    Delete Entity by Id  urn:ngsi-ld:Building:3009ef20-9f62-41f5-bd66-92f041b428b9
    Delete Entity by Id  urn:ngsi-ld:Building:56hy789-eft6-9987-be54-adr45nf567ddz
@@ -39,7 +82,7 @@ Batch Create Entities
    Output  response
    Set Test Variable  ${response}

Check HTTP Status Code Is
Check Response Status Code Set To
    [Arguments]  ${status}
    ${response_status}=  convert to string  ${response['status']}
    Should Be Equal  ${response_status}  ${status}
@@ -49,3 +92,8 @@ Delete Entity by Id
    ${response}=  DELETE  ${endpoint}/${id}
    Output  request
    Output  response

Check Response Body Set To
    [Arguments]  @{expected_entities_ids}
    Should Contain  ${response['body']['success']}  @{expected_entities_ids}
+30 −0
Original line number Diff line number Diff line
{
    "id": "urn:ngsi-ld:Building:56hy789-eft6-9987-be54-adr45nf567ddz",
    "type": "Building",
    "name": {
        "type": "Property",
        "value": "Eiffel Tower"
    },
    "subCategory": {
        "type": "Property",
        "value": ["tourism"]
    },
    "airQualityLevel": {
        "type": "Property",
        "value": 4,
        "unitCode": "C62",
        "observedAt": "2020-09-09T16:40:00.000Z",
        "hasWeatherObserved": {
            "type": "Relationship",
            "object": "urn:ngsi-ld:Sensor:43a1af27-4aa7-44fe-bee9-fe76d56978a4"
        }
    },
    "almostFull": {
        "type": "Property",
        "value": false
    },
    "@context": [
        "https://fiware.github.io/data-models/context.jsonld",
        "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"
    ]
}
 No newline at end of file
+26 −0
Original line number Diff line number Diff line
{
    "id": "urn:ngsi-ld:Building:56hy789-eft6-9987-be54-adr45nf567ddz",
    "type": "Building",
    "name": {
        "type": "Property",
        "value": "Eiffel Tower"
    },
    "subCategory": {
        "type": "Property",
        "value": ["tourism"]
    },
    "airQualityLevel": {
        "type": "Property",
        "value": 4,
        "unitCode": "C62",
        "observedAt": "2020-09-09T16:40:00.000Z"
    },
    "almostFull": {
        "type": "Property",
        "value": false
    },
    "@context": [
        "https://fiware.github.io/data-models/context.jsonld",
        "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"
    ]
}
 No newline at end of file