system: dmi information
This commit is contained in:
@@ -11,7 +11,8 @@ exports = module.exports = {
|
||||
getLogStream,
|
||||
getSystemGraphs,
|
||||
getBlockDevices,
|
||||
getCpus
|
||||
getCpus,
|
||||
getDmi
|
||||
};
|
||||
|
||||
const assert = require('assert'),
|
||||
@@ -151,3 +152,10 @@ 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,6 +33,19 @@ describe('System', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('dmi', function () {
|
||||
it('succeeds', async function () {
|
||||
const response = await superagent.get(`${serverUrl}/api/v1/system/dmi`)
|
||||
.query({ access_token: owner.token });
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.body.dmi).to.be.ok();
|
||||
|
||||
expect(response.body.dmi.sysVendor).to.be.a('string');
|
||||
expect(response.body.dmi.productName).to.be.a('string');
|
||||
});
|
||||
});
|
||||
|
||||
describe('logs', function () {
|
||||
before(function () {
|
||||
console.log(paths.BOX_LOG_FILE);
|
||||
|
||||
Reference in New Issue
Block a user