Skip to content

Commit bdb544d

Browse files
committed
test: add dedicated test for special named attr
1 parent b8b715c commit bdb544d

File tree

1 file changed

+61
-15
lines changed

1 file changed

+61
-15
lines changed

test/functional/testCases.js

Lines changed: 61 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -542,16 +542,6 @@ const testCases = [
542542
object_id: '.1.0.0.1',
543543
name: 'psBatteryVoltage',
544544
type: 'Number'
545-
},
546-
{
547-
object_id: 'fdt',
548-
name: 'fireDetectionThreshold',
549-
type: 'Number'
550-
},
551-
{
552-
object_id: 'fireDetectionThreshold3',
553-
name: 'fireDetectionThreshold3',
554-
type: 'Number'
555545
}
556546
],
557547
static_attributes: []
@@ -566,7 +556,7 @@ const testCases = [
566556
should: [
567557
{
568558
shouldName:
569-
'A - WHEN sending defined object_ids with special format names in attributes through http IT should send measures to Context Broker preserving value types, name mappings and metadatas',
559+
'A - WHEN sending defined object_ids with special format names (measures) through http IT should send measures to Context Broker preserving value types, name mappings and metadatas',
570560
type: 'single',
571561
measure: {
572562
url: 'http://localhost:' + config.http.port + '/iot/json',
@@ -577,10 +567,7 @@ const testCases = [
577567
},
578568
json: {
579569
a: false,
580-
'.1.0.0.1': 23.5,
581-
fdt: 10,
582-
fireDetectionThreshold2: 20,
583-
fireDetectionThreshold3: 30
570+
'.1.0.0.1': 23.5
584571
}
585572
},
586573
expectation: {
@@ -599,7 +586,66 @@ const testCases = [
599586
psBatteryVoltage: {
600587
type: 'Number',
601588
value: 23.5
589+
}
590+
}
591+
}
592+
]
593+
},
594+
{
595+
describeName: '0021c - Simple group with active attributes with special names in object_id',
596+
provision: {
597+
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
598+
method: 'POST',
599+
json: {
600+
services: [
601+
{
602+
resource: '/iot/json',
603+
apikey: globalEnv.apikey,
604+
entity_type: globalEnv.entity_type,
605+
commands: [],
606+
lazy: [],
607+
attributes: [
608+
{
609+
object_id: 'fdt',
610+
name: 'fireDetectionThreshold',
611+
type: 'Number'
612+
},
613+
{
614+
object_id: 'fireDetectionThreshold3',
615+
name: 'fireDetectionThreshold3',
616+
type: 'Number'
617+
}
618+
],
619+
static_attributes: []
620+
}
621+
]
622+
},
623+
headers: {
624+
'fiware-service': globalEnv.service,
625+
'fiware-servicepath': globalEnv.servicePath
626+
}
627+
},
628+
should: [
629+
{
630+
shouldName:
631+
'A - WHEN sending defined object_ids with special format names in attributes through http IT should send measures to Context Broker preserving value types, name mappings and metadatas',
632+
type: 'single',
633+
measure: {
634+
url: 'http://localhost:' + config.http.port + '/iot/json',
635+
method: 'POST',
636+
qs: {
637+
i: globalEnv.deviceId,
638+
k: globalEnv.apikey
602639
},
640+
json: {
641+
fdt: 10,
642+
fireDetectionThreshold2: 20,
643+
fireDetectionThreshold3: 30
644+
}
645+
},
646+
expectation: {
647+
id: globalEnv.entity_name,
648+
type: globalEnv.entity_type,
603649
fireDetectionThreshold: {
604650
type: 'Number',
605651
value: 10

0 commit comments

Comments
 (0)