def test_factories(): for factory_name, dependencies in test_tuples: factory = factory_builder.build(config, name=factory_name) injector = Injectark(factory=factory) for abstract, concrete in dependencies: result = injector.resolve(abstract) assert type(result).__name__ == concrete
async def test_config(test_data): for config in test_data: factory = build_factory(config) strategy = build_strategy(config['strategies'], config['strategy']) resolver = Injectark(strategy=strategy, factory=factory) resolver["TenantProvider"].setup(Tenant(id="1", name="default")) for resource in strategy.keys(): result = resolver.resolve(resource) classes = inspect.getmro(type(result)) assert resource in [item.__name__ for item in classes]
def test_factories(): for factory_name, strategy_names in test_tuples: factory = factory_builder.build(config, name=factory_name) strategy = strategy_builder.build(strategy_names) injector = Injectark(strategy=strategy, factory=factory) for resource in strategy.keys(): result = injector.resolve(resource) classes = inspect.getmro(type(result)) assert resource in [item.__name__ for item in classes]
async def main(args=None): # pragma: no cover logging.basicConfig() logging.getLogger().setLevel(config['loglevel']) factory = factory_builder.build(config) injector = Injectark(factory=factory) await Shell(config, injector).run(args or [])
def scheduler() -> Scheduler: config['factory'] = 'CheckFactory' factory = factory_builder.build(config) injector = Injectark(factory) return Scheduler(injector)
def shell() -> Shell: config['factory'] = 'CheckFactory' factory = factory_builder.build(config) injector = Injectark(factory) return Shell(injector)
async def main(args=None): # pragma: no cover strategy = strategy_builder.build(config['strategies']) factory = factory_builder.build(config) injector = Injectark(strategy=strategy, factory=factory) if config.get('auto'): injector['MigrationSupplier'].migrate() await Shell(config, injector).run(args or [])
def cli() -> Cli: """Create app testing client""" config = DEVELOPMENT_CONFIG strategy = strategy_builder.build(config['strategies'], config['strategy']) factory = factory_builder.build(config) injector = Injectark(strategy, factory) return Cli(config, injector)
async def main(args=None): factory = factory_builder.build(config) injector = Injectark(factory) await injector['SetupManager'].setup({}) await Shell(config, injector).run(args or []) del injector await asyncio.gather(*asyncio.all_tasks())
def shell() -> Shell: """Create app testing client""" config['factory'] = 'CheckFactory' factory = factory_builder.build(config) injector = Injectark(factory) return Shell(config, injector)
def app(loop, aiohttp_client): config['factory'] = 'CheckFactory' factory = factory_builder.build(config) injector = Injectark(factory) app = RestApplication(injector) return loop.run_until_complete(aiohttp_client(app))
def app(tmp_path, loop, aiohttp_client) -> web.Application: config = build_config('DEV') strategy = build_strategy(config['strategies'], config['strategy']) factory = build_factory(config) resolver = Injectark(strategy, factory) app = create_app(config, resolver) return loop.run_until_complete(aiohttp_client(app))
def main(args): # pragma: no cover mode = os.environ.get('ESTIMARK_MODE', 'PROD') config_path = os.environ.get('ESTIMARK_CONFIG', 'config.json') config = build_config(config_path, mode) factory = build_factory(config) strategy = config['strategy'] resolver = Injectark(strategy=strategy, factory=factory) Cli(config, resolver).run(args)
def shell() -> Shell: config['factory'] = 'BaseFactory' config['strategies'] = ['base'] strategy = strategy_builder.build(config['strategies']) factory = factory_builder.build(config) injector = Injectark(strategy, factory) return Shell(config, injector)
def app(loop, aiohttp_client): config['factory'] = 'CheckFactory' config['tokens']['verification']['secret'] = ('DEVSECRET123') factory = factory_builder.build(config) injector = Injectark(factory) app = RestApplication(injector) return loop.run_until_complete(aiohttp_client(app))
def test_create_app(): config['factory'] = 'CheckFactory' factory = factory_builder.build(config) injector = Injectark(factory) app = create_app(config, injector) assert app is not None assert isinstance(app, web.Application)
def main(args: List[str] = None): # pragma: no cover args = args or sys.argv[1:] logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, format='%(message)s') factory = factory_builder.build(config) injector = Injectark(factory) Shell(config, injector).run(args)
def app(loop, aiohttp_client): """Create app testing client""" config = DEVELOPMENT_CONFIG strategy = strategy_builder.build(config['strategies']) factory = factory_builder.build(config) resolver = Injectark(strategy, factory) app = create_app(config, resolver) return loop.run_until_complete(aiohttp_client(app))
def test_create_app(): config = build_config('DEV') strategy = build_strategy(config['strategies'], config['strategy']) factory = build_factory(config) injector = Injectark(strategy, factory) app = create_app(config, injector) assert app is not None assert isinstance(app, web.Application)
def app(loop, aiohttp_client): """Create app testing client""" config['factory'] = 'CheckFactory' factory = factory_builder.build(config) injector = Injectark(factory) app = create_app(config, injector) return loop.run_until_complete(aiohttp_client(app))
async def main(args=None): # pragma: no cover mode = os.environ.get('MEDIARK_MODE', 'PROD') config_path = os.environ.get('MEDIARK_CONFIG', 'config.json') config = build_config(mode, config_path) factory = build_factory(config) strategy = build_strategy(config['strategies'], config['strategy']) injector = Injectark(strategy=strategy, factory=factory) injector['SetupSupplier'].setup() await Cli(config, injector).run(args or [])
def test_create_app(): config = DEVELOPMENT_CONFIG strategy = strategy_builder.build(config['strategies']) factory = factory_builder.build(config) injector = Injectark(strategy, factory) app = create_app(config, injector) assert app is not None assert isinstance(app, web.Application)
def app(loop, aiohttp_client): """Create app testing client""" config['factory'] = 'CheckFactory' config['strategies'] = ['base', 'check'] strategy = strategy_builder.build(config['strategies']) factory = factory_builder.build(config) injector = Injectark(strategy, factory) app = RestApplication(config, injector) return loop.run_until_complete(aiohttp_client(app))
async def main(args=None): # pragma: no cover config_path = Path(os.environ.get('PROCESARK_CONFIG', 'config.json')) config = loads(config_path.read_text()) if config_path.is_file() else {} config: Config = {**PRODUCTION_CONFIG, **config} logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, format='%(message)s') factory = factory_builder.build(config) strategy = strategy_builder.build( config['strategies'], config['strategy']) injector = Injectark(strategy=strategy, factory=factory) # injector['SetupSupplier'].setup() await Cli(config, injector).run(args or [])
async def main(args=None): # pragma: no cover factory = factory_builder.build(config) injector = Injectark(factory=factory) await Shell(injector).run(args or [])
def trial_resolver(trial_config) -> Injectark: config = trial_config factory = build_factory(config) strategy = config['strategy'] resolver = Injectark(strategy=strategy, factory=factory) return resolver
def injector(config): config['factory'] = 'CheckFactory' factory = factory_builder.build(config) return Injectark(factory)
def injector(factory): injector = Injectark(factory) injector.config['notification']['url'] = ('https://api.service.com/events') return injector