Esempio n. 1
0
 def test_states_data(self, xpatch):
     log = mock.Mock()
     sp = config_op.StatesProvider(log)
     self.setup_log(sp)
     self.setup_states_data(xpatch.system)
     tctx = mock.Mock()
     obj = sp.get_object(tctx, None, {'device': mocklib.DEVICE_NAME})
     assert sorted(st['state']
                   for st in obj['states']) == sorted(self.states)
Esempio n. 2
0
 def __init__(self, daemon, actionpoint, log=None, init_args=None):
     # FIXME: really experimental
     self._state = dp._daemon_as_dict(daemon)
     ctx = self._state['ctx']
     self.log = log or self._state['log']
     dcb = experimental.DataCallbacks(self.log)
     dcb.register('/ncs:devices/ncs:device', coverage_op.DataHandler(self.log))
     _ncs.dp.register_data_cb(ctx, ns.ns.callpoint_coverage_data, dcb)
     scb = experimental.DataCallbacks(self.log)
     scb.register('/ncs:devices/ncs:device/drned-xmnr:drned-xmnr/drned-xmnr:state',
                  config_op.StatesProvider(self.log))
     _ncs.dp.register_data_cb(ctx, ns.ns.callpoint_xmnr_states, scb)