forked from FIWARE/NGSI-LD_TestSuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_csource_registration_test.js
54 lines (50 loc) · 1.96 KB
/
create_csource_registration_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const testedResource = require('../common.js').testedResource;
const assertRegistrationCreated = require('../common.js').assertRegistrationCreated;
const http = require('../http.js');
const registrationsResource = testedResource + '/csourceRegistrations/';
describe('Create Registration. JSON', () => {
it('should create registration from ETSI Example 130', async function() {
const registration = {
id: 'urn:ngsi-ld:ContextSourceRegistration:csr1a3456',
type: 'ContextSourceRegistration',
information: [
{
entities: [
{
id: 'urn:ngsi-ld:Vehicle:A456',
type: 'Vehicle'
},
{
idPattern: '.*downtown$',
type: 'OffStreetParking'
},
{
idPattern: '.*47$',
type: 'OffStreetParking'
}
],
properties: ['brandName', 'speed', 'availableSpotNumber', 'totalSpotNumber'],
relationships: ['isParked', 'isNextToBuilding']
}
],
endpoint: 'http://my.csource.org:1026',
location: {
type: 'Polygon',
coordinates: [
[
[100.0, 0.0],
[101.0, 0.0],
[101.0, 1.0],
[100.0, 1.0],
[100.0, 0.0]
]
]
}
};
const response = await http.post(registrationsResource, registration);
assertRegistrationCreated(response.response, registration.id);
});
afterEach(() => {
return http.delete(registrationsResource + 'urn:ngsi-ld:ContextSourceRegistration:csr1a3456');
});
});