예제 #1
0
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.get_commander(app),
        datastore.get_datastore(app),
        device.get_controller(app),
        events.get_listener(app),
        broadcaster.get_broadcaster(app)
    ]
예제 #2
0
    async def _seed_datastore(self):
        try:
            api = object_api.ObjectApi(self.app, wait_sync=False)
            sys_block = await api.read(datastore.SYSINFO_NID)
            device_id = sys_block[object_api.API_DATA_KEY]['deviceId']

            await datastore.check_remote(self.app)
            await asyncio.gather(
                datastore.get_datastore(self.app).read(f'{device_id}-blocks-db'),
                datastore.get_config(self.app).read(f'{device_id}-config-db'),
                datastore.get_savepoints(self.app).read(f'{device_id}-savepoints-db'),
            )

        except asyncio.CancelledError:
            raise

        except Exception as ex:
            warnings.warn(f'Failed to seed datastore - {type(ex).__name__}({ex})')
예제 #3
0
def store(app):
    return datastore.get_datastore(app)
예제 #4
0
async def store(app, client):
    return datastore.get_datastore(app)
예제 #5
0
 def __init__(self, app: web.Application, wait_sync=True):
     self._wait_sync = wait_sync
     self._status = status.get_status(app)
     self._ctrl: device.SparkController = device.get_controller(app)
     self._store: twinkeydict.TwinKeyDict = datastore.get_datastore(app)
예제 #6
0
 def __init__(self, app: web.Application):
     self._app = app
     self._datastore = datastore.get_datastore(app)
     self._codec = codec.get_codec(app)
예제 #7
0
 def __init__(self, app: web.Application):
     self._store = datastore.get_datastore(app)