def test_not_json(self): """ fdw.GeoJSON.execute receive non-JSON response """ options = {'url': 'http://raw.githubusercontent.com'} columns = ['geom'] fdw = GeoJSON(options, columns) rows = fdw.execute([], columns) self.assertListEqual(rows, [])
def test_not_json(self): """ fdw.GeoJSON.execute receive non-JSON response """ options = {'url' : 'http://raw.githubusercontent.com'} columns = ['geom'] fdw = GeoJSON(options, columns) rows = fdw.execute([], columns) self.assertListEqual(rows, [])
def test_execute_bad_url(self): """ fdw.GeoJSON.execute non-existant URL """ options = {'url': 'http://d.xyz'} columns = ['geom'] fdw = GeoJSON(options, columns) rows = fdw.execute([], columns) self.assertListEqual(rows, [])
def test_execute_bad_url(self): """ fdw.GeoJSON.execute non-existant URL """ options = {'url' : 'http://d.xyz'} columns = ['geom'] fdw = GeoJSON(options, columns) rows = fdw.execute([], columns) self.assertListEqual(rows, [])
def test_not_geojson(self): """ fdw.GeoJSON.execute receive non-GeoJSON response """ options = {'url' : 'https://raw.githubusercontent.com/fge/sample-json-schemas/master/json-home/json-home.json'} columns = ['geom'] fdw = GeoJSON(options, columns) rows = fdw.execute([], columns) self.assertListEqual(rows, [])
def test_geojson_attribute(self): """ fdw.GeoJSON.execute receive GeoJSON response with non-spatial attribute """ options = {'url' : self.EXAMPLE} columns = ['geom', 'NAME'] fdw = GeoJSON(options, columns) rows = fdw.execute([], ['NAME']) for row in rows: self.assertIn(row['NAME'], ['Alex', 'Bonnie', 'Charley', 'Danielle', 'Earl', 'Frances', 'Gaston', 'Hermine', 'Ivan', 'Tropical Depression 2', 'Tropical Depression 10', 'Jeanne', 'Karl', 'Lisa', 'Matthew', 'Nicole', 'Otto'])
def test_geojson(self): """ fdw.GeoJSON.execute receive GeoJSON response """ options = {'url' : self.EXAMPLE} columns = ['geom'] fdw = GeoJSON(options, columns) rows = fdw.execute([], columns) for row in rows: self.assertIsInstance(row['geom'], str)
def test_geojson(self): """ fdw.GeoJSON.execute receive GeoJSON response """ options = {'url': self.EXAMPLE} columns = ['geom'] fdw = GeoJSON(options, columns) rows = fdw.execute([], columns) for row in rows: wkb = row["geom"] geom = Geometry(wkb) self.assertIsInstance(geom, Point)
def test_not_geojson(self): """ fdw.GeoJSON.execute receive non-GeoJSON response """ options = { 'url': 'https://raw.githubusercontent.com/fge/sample-json-schemas/master/json-home/json-home.json' } columns = ['geom'] fdw = GeoJSON(options, columns) rows = fdw.execute([], columns) self.assertListEqual(rows, [])
def test_geojson_attribute(self): """ fdw.GeoJSON.execute receive GeoJSON response with non-spatial attribute """ options = {'url': self.EXAMPLE} columns = ['geom', 'NAME'] fdw = GeoJSON(options, columns) rows = fdw.execute([], ['NAME']) for row in rows: self.assertIn(row['NAME'], [ 'Alex', 'Bonnie', 'Charley', 'Danielle', 'Earl', 'Frances', 'Gaston', 'Hermine', 'Ivan', 'Tropical Depression 2', 'Tropical Depression 10', 'Jeanne', 'Karl', 'Lisa', 'Matthew', 'Nicole', 'Otto' ])