2019-09-12 15:26:21 +00:00
|
|
|
process.env.ROOT_MOUNTPOINT = './test/data';
|
|
|
|
process.env.BOOT_MOUNTPOINT = '/mnt/boot';
|
|
|
|
process.env.CONFIG_JSON_PATH = '/config.json';
|
|
|
|
process.env.DATABASE_PATH = './test/data/database.sqlite';
|
|
|
|
process.env.DATABASE_PATH_2 = './test/data/database2.sqlite';
|
|
|
|
process.env.DATABASE_PATH_3 = './test/data/database3.sqlite';
|
|
|
|
process.env.LED_FILE = './test/data/led_file';
|
|
|
|
|
2020-04-09 10:41:48 +00:00
|
|
|
import * as dbus from 'dbus';
|
2020-05-11 01:03:16 +00:00
|
|
|
import { DBusError, DBusInterface } from 'dbus';
|
|
|
|
import { stub } from 'sinon';
|
2019-09-12 15:26:21 +00:00
|
|
|
|
2020-04-09 10:41:48 +00:00
|
|
|
stub(dbus, 'getBus').returns({
|
|
|
|
getInterface: (
|
2020-05-11 01:03:16 +00:00
|
|
|
_serviceName: string,
|
|
|
|
_objectPath: string,
|
|
|
|
_interfaceName: string,
|
|
|
|
interfaceCb: (err: null | DBusError, iface: DBusInterface) => void,
|
2020-04-09 10:41:48 +00:00
|
|
|
) => {
|
2020-05-11 01:03:16 +00:00
|
|
|
interfaceCb(null, {
|
|
|
|
Get: (
|
|
|
|
_unitName: string,
|
|
|
|
_property: string,
|
|
|
|
getCb: (err: null | Error, value: unknown) => void,
|
|
|
|
) => {
|
|
|
|
getCb(null, 'this is the value');
|
|
|
|
},
|
|
|
|
GetUnit: (
|
|
|
|
_unitName: string,
|
|
|
|
getUnitCb: (err: null | Error, unitPath: string) => void,
|
|
|
|
) => {
|
|
|
|
getUnitCb(null, 'this is the unit path');
|
|
|
|
},
|
|
|
|
} as any);
|
2019-09-12 15:26:21 +00:00
|
|
|
},
|
2020-04-09 10:41:48 +00:00
|
|
|
} as any);
|