Loading karate/src/test/java/api/entities/create-entities.feature +3 −1 Original line number Diff line number Diff line @entities Feature: Test implementation of POST /entities (6.4.3.1) with different entity payloads TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases Background: * url urlBase Loading @@ -17,11 +18,12 @@ Background: } """ Scenario Outline: Create Buildings with different payloads Scenario Outline: Create some entities with different payloads Given path 'entities' And request __row And header Content-Type = 'application/ld+json' When method post Then status 201 And match header Location == '/ngsi-ld/v1/entities/' + __row.id Examples: | buildings | No newline at end of file karate/src/test/java/api/entities/create-entity-with-invalid-request.feature +13 −11 Original line number Diff line number Diff line @entities Feature: Test implementation of POST /entities (6.4.3.1) with invalid request Feature: Test implementation of POST /entities (6.4.3.1) with invalid requests TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/InvalidCases Background: * url urlBase Loading @@ -10,37 +11,38 @@ Background: * def token = accessToken * configure headers = read('classpath:headers.js') Scenario: Create Building with unsupported Media type Scenario: Create an entity with an unsupported media type Given path 'entities' And request building And header Content-Type = 'application/unkwnown' When method post Then status 415 Scenario: Create Building with wrong Media type (application/json with JSON-LD payload) Scenario: Create an entity with wrong media type (application/json with JSON-LD payload) Given path 'entities' And request building And header Content-Type = 'application/json' When method post Then status 400 And match response.title == 'The request includes input data which does not meet the requirements of the operation' And match response.detail == '#notnull' # Actually it should be InvalidRequest, let's pretend you have not seen it And match response.type == 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' And match response.title == '#notnull' Scenario: Create Building with wrong Media type (application/ld+json with JSON-LD Link header) Scenario: Create an entity with wrong media type (application/ld+json with JSON-LD Link header) Given path 'entities' And request building And header Content-Type = 'application/ld+json' And header Link = '<https://fiware.github.io/data-models/context.jsonld>; rel=http://www.w3.org/ns/json-ld#context; type=application/ld+json' When method post Then status 400 And match response.title == 'The request includes input data which does not meet the requirements of the operation' And match response.detail == '#notnull' And match response.type == 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' And match response.title == '#notnull' Scenario: Create Building with wrong Media type (application/ld+json without @context in the payload) Scenario: Create an entity with wrong media type (application/ld+json without @context in the payload) Given path 'entities' And request buildingWithoutContext And header Content-Type = 'application/ld+json' When method post Then status 400 And match response.title == 'The request includes input data which does not meet the requirements of the operation' And match response.detail == '#notnull' No newline at end of file And match response.type == 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' And match response.title == '#notnull' karate/src/test/java/api/entities/create-existing-entity.feature +4 −1 Original line number Diff line number Diff line @entities Feature: Test implementation of POST /entities (6.4.3.1) with existing entity TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/AlreadyExists Background: * url urlBase Loading @@ -16,9 +17,11 @@ Background: } """ Scenario: Scenario: Check that you cannot create an entity if there is already one with the same identifier Given path 'entities' And request building And header Content-Type = 'application/ld+json' When method post Then status 409 And match response.type == 'https://uri.etsi.org/ngsi-ld/errors/AlreadyExists' And match response.title == '#notnull' Loading
karate/src/test/java/api/entities/create-entities.feature +3 −1 Original line number Diff line number Diff line @entities Feature: Test implementation of POST /entities (6.4.3.1) with different entity payloads TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/SuccessCases Background: * url urlBase Loading @@ -17,11 +18,12 @@ Background: } """ Scenario Outline: Create Buildings with different payloads Scenario Outline: Create some entities with different payloads Given path 'entities' And request __row And header Content-Type = 'application/ld+json' When method post Then status 201 And match header Location == '/ngsi-ld/v1/entities/' + __row.id Examples: | buildings | No newline at end of file
karate/src/test/java/api/entities/create-entity-with-invalid-request.feature +13 −11 Original line number Diff line number Diff line @entities Feature: Test implementation of POST /entities (6.4.3.1) with invalid request Feature: Test implementation of POST /entities (6.4.3.1) with invalid requests TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/InvalidCases Background: * url urlBase Loading @@ -10,37 +11,38 @@ Background: * def token = accessToken * configure headers = read('classpath:headers.js') Scenario: Create Building with unsupported Media type Scenario: Create an entity with an unsupported media type Given path 'entities' And request building And header Content-Type = 'application/unkwnown' When method post Then status 415 Scenario: Create Building with wrong Media type (application/json with JSON-LD payload) Scenario: Create an entity with wrong media type (application/json with JSON-LD payload) Given path 'entities' And request building And header Content-Type = 'application/json' When method post Then status 400 And match response.title == 'The request includes input data which does not meet the requirements of the operation' And match response.detail == '#notnull' # Actually it should be InvalidRequest, let's pretend you have not seen it And match response.type == 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' And match response.title == '#notnull' Scenario: Create Building with wrong Media type (application/ld+json with JSON-LD Link header) Scenario: Create an entity with wrong media type (application/ld+json with JSON-LD Link header) Given path 'entities' And request building And header Content-Type = 'application/ld+json' And header Link = '<https://fiware.github.io/data-models/context.jsonld>; rel=http://www.w3.org/ns/json-ld#context; type=application/ld+json' When method post Then status 400 And match response.title == 'The request includes input data which does not meet the requirements of the operation' And match response.detail == '#notnull' And match response.type == 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' And match response.title == '#notnull' Scenario: Create Building with wrong Media type (application/ld+json without @context in the payload) Scenario: Create an entity with wrong media type (application/ld+json without @context in the payload) Given path 'entities' And request buildingWithoutContext And header Content-Type = 'application/ld+json' When method post Then status 400 And match response.title == 'The request includes input data which does not meet the requirements of the operation' And match response.detail == '#notnull' No newline at end of file And match response.type == 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' And match response.title == '#notnull'
karate/src/test/java/api/entities/create-existing-entity.feature +4 −1 Original line number Diff line number Diff line @entities Feature: Test implementation of POST /entities (6.4.3.1) with existing entity TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/AlreadyExists Background: * url urlBase Loading @@ -16,9 +17,11 @@ Background: } """ Scenario: Scenario: Check that you cannot create an entity if there is already one with the same identifier Given path 'entities' And request building And header Content-Type = 'application/ld+json' When method post Then status 409 And match response.type == 'https://uri.etsi.org/ngsi-ld/errors/AlreadyExists' And match response.title == '#notnull'