Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add functional test case about how use special word valueas a name of attribute #1668

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions test/functional/testCases.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,20 @@ const testCases = [
object_id: '.1.0.0.1',
name: 'psBatteryVoltage',
type: 'Number'
},
{
object_id: 't',
name: 'value',
type: 'Number'
},
{
name: 'fireDetectionThreshold',
type: 'Number'
},
Comment on lines +551 to +554
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about?

Suggested change
{
name: 'fireDetectionThreshold',
type: 'Number'
},
{
name: 'fireDetectionThreshold',
type: 'Number'
},
{
object_id: 'fdt',
name: 'fireDetectionThreshold',
type: 'Number'
},

next

  • Send mesuare fdt: 20 -> CB expectations fireDetectionThreshold: 20
  • Send mesuare fireDetectionThreshold: 20 -> CB expectations fireDetectionThreshold: 20

{
object_id: 'fireDetectionThreshold3',
name: 'fireDetectionThreshold3',
type: 'Number'
}
],
static_attributes: []
Expand Down Expand Up @@ -588,6 +602,56 @@ const testCases = [
value: 23.5
}
}
},
{
shouldName:
'B - 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',
type: 'single',
measure: {
url: 'http://localhost:' + config.http.port + '/iot/json',
method: 'POST',
qs: {
i: globalEnv.deviceId,
k: globalEnv.apikey
},
json: {
a: false,
t: 10,
fireDetectionThreshold: 10,
fireDetectionThreshold2: 20,
fireDetectionThreshold3: 30
}
},
expectation: {
id: globalEnv.entity_name,
type: globalEnv.entity_type,
attr_a: {
value: false,
type: 'Boolean',
metadata: {
accuracy: {
value: 0.8,
type: 'Float'
}
}
},
value: {
type: 'Number',
value: 10
},
fireDetectionThreshold: {
type: 'Number',
value: 10
},
fireDetectionThreshold2: {
type: 'Text',
value: 20
},
fireDetectionThreshold3: {
type: 'Number',
value: 30
}
}
}
]
},
Expand Down
Loading