def test_create_valid(): """Should work as expected.""" runner = CliRunner() with runner.isolated_filesystem(): with open("./list.txt", "w") as f: f.write("\n") f.write("\n".join(assets)) f.write("\n") result = runner.invoke(cogeo_cli, ["create", "list.txt", "--quiet"]) assert not result.exception assert result.exit_code == 0 assert mosaic_content == MosaicJSON(**json.loads(result.output)) result = runner.invoke(cogeo_cli, ["create", "list.txt", "-o", "mosaic.json"]) assert not result.exception assert result.exit_code == 0 assert mosaic_content == MosaicJSON.parse_file("mosaic.json") result = runner.invoke( cogeo_cli, [ "create", "list.txt", "-o", "mosaic.json", "--name", "my_mosaic", "--description", "A mosaic", "--attribution", "someone", ], ) assert not result.exception assert result.exit_code == 0 mosaic = MosaicJSON.parse_file("mosaic.json") assert mosaic.name == "my_mosaic" assert mosaic.description == "A mosaic" assert mosaic.attribution == "someone"
def test_from_features(): """Should work as expected.""" runner = CliRunner() with runner.isolated_filesystem(): with open("./list.txt", "w") as f: f.write("\n".join([asset1, asset2])) result = runner.invoke( cogeo_cli, ["footprint", "list.txt", "-o", "mosaic.geojson"] ) with open("mosaic.geojson", "r") as f: features = f.read() result = runner.invoke( cogeo_cli, [ "create-from-features", "--minzoom", "7", "--maxzoom", "9", "--property", "path", "--quiet", ], input=features, ) assert not result.exception assert result.exit_code == 0 assert mosaic_content == MosaicJSON(**json.loads(result.output)) result = runner.invoke( cogeo_cli, [ "create-from-features", "--minzoom", "7", "--maxzoom", "9", "--property", "path", "-o", "mosaic.json", "--quiet", ], input=features, ) assert not result.exception assert result.exit_code == 0 assert mosaic_content == MosaicJSON.parse_file("mosaic.json") result = runner.invoke( cogeo_cli, [ "create-from-features", "--minzoom", "7", "--maxzoom", "9", "--property", "path", "--name", "my_mosaic", "--description", "A mosaic", "--attribution", "someone", "--quiet", ], input=features, ) assert not result.exception assert result.exit_code == 0 mosaic = MosaicJSON(**json.loads(result.output)) assert mosaic.name == "my_mosaic" assert mosaic.description == "A mosaic" assert mosaic.attribution == "someone"