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' ])
def test_no_authentication(self): """ fdw.GeoJSON.__init__ disable authentication """ options = {'url': self.EXAMPLE} columns = ['geom'] fdw = GeoJSON(options, columns) self.assertEquals(fdw.auth, None)
def test_authentication(self): """ fdw.GeoJSON.__init__ use authentication """ options = {'url': self.EXAMPLE, 'user': '******', 'pass': '******'} columns = ['geom'] fdw = GeoJSON(options, columns) self.assertEquals(fdw.auth, ('name', 'secret'))
def test_no_verify_ssl(self): """ fdw.GeoJSON.__init__ disable SSL verify """ options = {'url': self.EXAMPLE, 'verify': 'false'} columns = ['geom'] fdw = GeoJSON(options, columns) self.assertEquals(fdw.verify, False)
def test_srid(self): """ fdw.GeoJSON.__init__ set custom SRID """ options = {'url': self.EXAMPLE, 'srid': '900913'} columns = ['geom'] fdw = GeoJSON(options, columns) self.assertEquals(fdw.srid, 900913)