예제 #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, [])
예제 #2
0
파일: geojson.py 프로젝트: Vadim0908/geofdw
 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, [])
예제 #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, [])
예제 #4
0
파일: geojson.py 프로젝트: Vadim0908/geofdw
 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, [])
예제 #5
0
파일: geojson.py 프로젝트: Vadim0908/geofdw
 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, [])
예제 #6
0
파일: geojson.py 프로젝트: Vadim0908/geofdw
 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'])
예제 #7
0
파일: geojson.py 프로젝트: Vadim0908/geofdw
 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)
예제 #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)
예제 #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, [])
예제 #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'
         ])
예제 #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)
예제 #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'))
예제 #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)
예제 #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)