def test_creating_from_json(): data = { "dict": {}, "string": "str", "int": 4, "float": 3.4, } config = Config.from_json(data) for key, value in data.items(): assert getattr(config, key) == value
def app_main(description, create_app): args = _parse_args(description) loop = asyncio.get_event_loop() secrets = {"TELEGRAM_TOKEN": os.environ["TELEGRAM_TOKEN"]} try: config = Config.from_file("config.json") except Exception: config = Config.from_json({"CHAT_ID": os.environ["CHAT_ID"]}) app = create_app(loop=loop, secrets=secrets, config=config) web.run_app(app, host=args.host, port=args.port)