Added test for remote JSON.
@@ -21,6 +21,8 @@ from jinja2 import Environment, PackageLoader
from six import PY3
import branca.element
+import requests
+
import folium
from folium.map import Popup, Marker, FitBounds, FeatureGroup
from folium.features import TopoJson, RectangleMarker, PolygonMarker
@@ -448,3 +450,16 @@ class TestFolium(object):
assert (mapd.global_switches.prefer_canvas is True and
mapd.global_switches.no_touch is True and
mapd.global_switches.disable_3d is True)
+
+ def test_json_request(self):
+ """Test requests for remote GeoJSON files."""
+ self.map = folium.Map(zoom_start=4)
+
+ # Adding remote GeoJSON as additional layer.
+ path = 'https://raw.githubusercontent.com/python-visualization/folium/master/examples/data/us-states.json'
+ self.map.choropleth(geo_path=path,
+ smooth_factor=0.5)
+
+ self.map._parent.render()
+ bounds = self.map.get_bounds()
+ assert bounds == [[18.948267, -178.123152], [71.351633, 173.304726]], bounds
