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

test: add multimeasure functional test #795

Closed
wants to merge 1 commit into from
Closed
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
100 changes: 100 additions & 0 deletions test/functional/functional-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,106 @@ describe('FUNCTIONAL TESTS', function () {
});
});

describe('Basic group provision with attributes and multimeasure', function () {
const provision = {
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
method: 'POST',
json: {
services: [
{
resource: '/iot/json',
apikey: '123456',
entity_type: 'TheLightType3',
cbHost: 'http://192.168.1.1:1026',
commands: [],
lazy: [],
attributes: [
{
object_id: 's',
name: 'status',
type: 'Boolean'
},
{
object_id: 't',
name: 'temperature',
type: 'Number'
}
],
static_attributes: []
}
]
},
headers: {
'fiware-service': 'smartgondor',
'fiware-servicepath': '/gardens'
}
};

const multimeasure = {
url: 'http://localhost:' + config.http.port + '/iot/json',
method: 'POST',
qs: {
i: 'MQTT_2',
k: '123456'
},
json: [
{
s: true,
t: 11
},
{
s: false,
t: 10
},
]
};

const expectation = [
{
id: 'TheLightType3:MQTT_2',
type: 'TheLightType3',
temperature: {
value: 11,
type: 'Number'
},
status: {
value: true,
type: 'Boolean'
}
},
{
id: 'TheLightType3:MQTT_2',
type: 'TheLightType3',
temperature: {
value: 10,
type: 'Number'
},
status: {
value: false,
type: 'Boolean'
}
}
];

beforeEach(function (done) {
request(provision, function (error, response, body) {
let err = null;
if (response.statusCode !== 201) {
err = new Error('Error creating the device group');
}
done(err);
});
});

afterEach(function () {
nock.cleanAll();
});

it('should send its value to the Context Broker', async function () {
await testUtils.testCase(multimeasure, expectation, provision, env, config, 'single', 'MQTT');
});
});

describe('Basic group provision with attributes and multientity', function () {
const provision = {
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
Expand Down
Loading