def fixture_app_with_data(app): with app.app_context(): with open("tests/data/config/places.json") as fp: resourcemgr.create_new_resource_from_file(fp) with open("tests/data/config/municipalities.json") as fp: resourcemgr.create_new_resource_from_file(fp) return app
def fun(**kwargs): app = next(app_f_scope_module(**kwargs)) with app.app_context(): for file in [ "tests/data/config/places.json", "tests/data/config/municipalities.json", ]: with open(file) as fp: resource, version = resourcemgr.create_new_resource_from_file(fp) resourcemgr.setup_resource_class(resource, version) if kwargs.get("use_elasticsearch", False): indexmgr.publish_index(resource, version) return app
def create_resource(config, config_dir): if config: with open(config) as fp: new_resource = resourcemgr.create_new_resource_from_file(fp) new_resources = [new_resource] elif config_dir: new_resources = resourcemgr.create_new_resource_from_dir(config_dir) else: click.echo("Must give either --config or --config-dir") raise click.exceptions.Exit(3) # Usage error for (resource_id, version) in new_resources: click.echo( "Created version {version} of resource {resource_id}".format( version=version, resource_id=resource_id ) )