2020-10-30 21:38:19 +00:00
|
|
|
import * as dbus from 'dbus';
|
|
|
|
import { DBusError, DBusInterface } from 'dbus';
|
|
|
|
import { stub } from 'sinon';
|
|
|
|
|
|
|
|
stub(dbus, 'getBus').returns({
|
|
|
|
getInterface: (
|
|
|
|
_serviceName: string,
|
|
|
|
_objectPath: string,
|
|
|
|
_interfaceName: string,
|
|
|
|
interfaceCb: (err: null | DBusError, iface: DBusInterface) => void,
|
|
|
|
) => {
|
|
|
|
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');
|
|
|
|
},
|
2020-11-26 06:11:47 +00:00
|
|
|
StartUnit: (_unitName: string) => {
|
|
|
|
// noop
|
|
|
|
},
|
2021-02-03 10:04:37 +00:00
|
|
|
RestartUnit: (_unitName: string, _mode: string) => {
|
|
|
|
// noop
|
|
|
|
},
|
2020-10-30 21:38:19 +00:00
|
|
|
} as any);
|
|
|
|
},
|
|
|
|
} as any);
|