system: merge info and dmi routes
also return uptimeSecs instead of abstract date
This commit is contained in:
@@ -12,7 +12,6 @@ exports = module.exports = {
|
||||
getSystemGraphs,
|
||||
getBlockDevices,
|
||||
getCpus,
|
||||
getDmi
|
||||
};
|
||||
|
||||
const assert = require('assert'),
|
||||
@@ -152,10 +151,3 @@ async function getCpus(req, res, next) {
|
||||
|
||||
next(new HttpSuccess(200, { cpus }));
|
||||
}
|
||||
|
||||
async function getDmi(req, res, next) {
|
||||
const [error, dmi] = await safe(system.getDmi());
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, { dmi }));
|
||||
}
|
||||
|
||||
@@ -33,16 +33,18 @@ describe('System', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('dmi', function () {
|
||||
describe('info', function () {
|
||||
it('succeeds', async function () {
|
||||
const response = await superagent.get(`${serverUrl}/api/v1/system/dmi`)
|
||||
const response = await superagent.get(`${serverUrl}/api/v1/system/info`)
|
||||
.query({ access_token: owner.token });
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.body.dmi).to.be.ok();
|
||||
expect(response.body.info).to.be.ok();
|
||||
|
||||
expect(response.body.dmi.sysVendor).to.be.a('string');
|
||||
expect(response.body.dmi.productName).to.be.a('string');
|
||||
expect(response.body.info.sysVendor).to.be.a('string');
|
||||
expect(response.body.info.productName).to.be.a('string');
|
||||
expect(response.body.info.uptimeSecs).to.be.a('number');
|
||||
expect(response.body.info.rebootRequired).to.be.a('boolean');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user