Commit 39115c9b authored by root's avatar root
Browse files

Added consumption/entity/001.robot

parent 4b79906c
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can get an entity by id
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

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

*** Test Cases ***                               
001_01_Check that you can get an entity by id
    [Documentation]  Check that you can get an entity by id
    [Tags]  mandatory

    ${entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${request}    ${response}=    Create Entity Selecting Content Type  building-simple-attributes-sample.jsonld     ${entity_id}    application/ld+json
    Check Response Status Code  201    ${response['status']}

    ${response}=    Retrieve Entity by Id Returning Response    ${entity_id}    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code  200    ${response['status']}

    [Teardown]  Delete Entity by Id Returning Response   ${entity_id}
 No newline at end of file

resources/ApiUtils.resource

100644 → 100755
+11 −1
Original line number Diff line number Diff line
@@ -64,12 +64,22 @@ Delete Entity by Id
    Output  request
    Output  response

Retrieve Entity by Id Returning Response
    [Arguments]  ${id}      ${accept}     ${context}=${EMPTY}
    ${headers}=  Create Dictionary
    Set To Dictionary   ${headers}   Accept    ${accept}
    Run Keyword If     '${context}'!=''       Set To Dictionary   ${headers}   Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json"
    ${response}=  GET  ${ENTITIES_ENDPOINT_PATH}${id}  headers=${headers}
    Output  request
    Output  response
    [return]    ${response}

Retrieve Entity by Id
    [Arguments]  ${id}      ${accept}=${CONTENT_TYPE_LD_JSON}     ${context}=${EMPTY}
    ${headers}=  Create Dictionary
    Set To Dictionary   ${headers}   Accept    ${accept}
    Run Keyword If     '${context}'!=''       Set To Dictionary   ${headers}   Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json"
    ${response}=  GET  ${ENTITIES_ENDPOINT_PATH}/${id}  headers=${headers}
    ${response}=  GET  ${ENTITIES_ENDPOINT_PATH}${id}  headers=${headers}
    Output  request
    Output  response
    Set Test Variable    ${response}
+0 −0

File mode changed from 100644 to 100755.