def __init__(self, app: web.Application): super().__init__(app) self._name = app['config']['name'] self._cmder = commander.fget(app) self._store = block_store.fget(app) self._discovery_lock: asyncio.Lock = None self._conn_check_lock: asyncio.Lock = None
async def test_cleanup(app, client, block_args): store = block_store.fget(app) await response(client.post('/blocks/create', json=block_args), 201) store['unused', 456] = {} retv = await response(client.post('/blocks/cleanup')) assert {'id': 'unused', 'nid': 456} in retv assert not [v for v in retv if v['id'] == 'testobj']
def __init__(self, app: web.Application): super().__init__(app) self.codec = codec.fget(app) self.commander = commander.fget(app) self.service_store = service_store.fget(self.app) self.global_store = global_store.fget(self.app) self.block_store = block_store.fget(self.app)
def test_main(mocker, app): mocker.patch(TESTED + '.service.run') mocker.patch(TESTED + '.service.create_app').return_value = app main.main() assert None not in [ commander.fget(app), service_store.fget(app), block_store.fget(app), controller.fget(app), mqtt.handler(app), broadcaster.fget(app) ]
async def format_trace(self, src): cdc = codec.fget(self.app) store = block_store.fget(self.app) dest = [] for src_v in src: action = src_v['action'] nid = src_v['id'] sid = store.left_key(nid, 'Unknown') typename = await cdc.decode(src_v['type']) if nid == 0: dest.append(action) else: dest.append(f'{action.ljust(20)} {typename.ljust(20)} [{sid},{nid}]') return dest
async def store(app, client): return block_store.fget(app)
def __init__(self, app: web.Application): self._app = app self._name = app['config']['name'] self._store = block_store.fget(app) self._codec = codec.fget(app)
def __init__(self, app: web.Application): self.app = app self._spark = spark.fget(app) self._store = block_store.fget(app) self._publish_changed = True
def store(app): return block_store.fget(app)
async def _sync_block_store(self): store = block_store.fget(self.app) await datastore.check_remote(self.app) await store.read(self.device_name)