Esempio n. 1
0
 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, [])
Esempio n. 2
0
 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, [])
Esempio n. 3
0
 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, [])
Esempio n. 4
0
 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, [])
Esempio n. 5
0
 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, [])
Esempio n. 6
0
 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'])
Esempio n. 7
0
 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)
Esempio n. 8
0
 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)
Esempio n. 9
0
 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, [])
Esempio n. 10
0
 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'
         ])
Esempio n. 11
0
 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)
Esempio n. 12
0
 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'))
Esempio n. 13
0
 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)
Esempio n. 14
0
 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)