Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_ogr_opaif_init():
gdaltest.opaif_drv = ogr.GetDriverByName('OAPIF')
if gdaltest.opaif_drv is None:
pytest.skip()
(gdaltest.webserver_process, gdaltest.webserver_port) = \
webserver.launch(handler=webserver.DispatcherHttpHandler)
if gdaltest.webserver_port == 0:
pytest.skip()
def ogr_wfs_fake_wfs_server():
if gdaltest.wfs_drv is None:
return 'skip'
(process, port) = webserver.launch()
if port == 0:
return 'skip'
gdal.SetConfigOption('OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN', 'NO')
ds = ogr.Open("WFS:http://127.0.0.1:%d/fakewfs" % port)
gdal.SetConfigOption('OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN', None)
if ds is None:
gdaltest.post_reason('did not managed to open WFS datastore')
webserver.server_stop(process, port)
return 'fail'
lyr = ds.GetLayerByName('rijkswegen')
if lyr.GetName() != 'rijkswegen':
gdaltest.post_reason('did not get expected layer name')
print(lyr.GetName())
webserver.server_stop(process, port)
def test_ogr_gmlas_xlink_resolver():
if ogr.GetDriverByName('GMLAS') is None:
pytest.skip()
drv = gdal.GetDriverByName('HTTP')
if drv is None:
pytest.skip()
(webserver_process, webserver_port) = webserver.launch(handler=GMLASHTTPHandler)
if webserver_port == 0:
pytest.skip()
gdal.FileFromMemBuffer('/vsimem/ogr_gmlas_xlink_resolver.xsd',
"""
def test_vsiswift_start_webserver():
gdaltest.webserver_process = None
gdaltest.webserver_port = 0
if not gdaltest.built_against_curl():
pytest.skip()
(gdaltest.webserver_process, gdaltest.webserver_port) = webserver.launch(handler=webserver.DispatcherHttpHandler)
if gdaltest.webserver_port == 0:
pytest.skip()
def test_mbtiles_start_webserver():
if gdaltest.mbtiles_drv is None:
pytest.skip()
if gdal.GetDriverByName('HTTP') is None:
pytest.skip()
(gdaltest.webserver_process, gdaltest.webserver_port) = webserver.launch(handler=webserver.DispatcherHttpHandler)
if gdaltest.webserver_port == 0:
pytest.skip()
def test_ogr_mvt_http_start():
gdaltest.webserver_process = None
gdaltest.webserver_port = 0
if not gdaltest.built_against_curl():
pytest.skip()
(gdaltest.webserver_process, gdaltest.webserver_port) = webserver.launch(handler=webserver.DispatcherHttpHandler)
if gdaltest.webserver_port == 0:
pytest.skip()
def test_vsigs_start_webserver():
gdaltest.webserver_process = None
gdaltest.webserver_port = 0
if not gdaltest.built_against_curl():
pytest.skip()
(gdaltest.webserver_process, gdaltest.webserver_port) = webserver.launch(handler=webserver.DispatcherHttpHandler)
if gdaltest.webserver_port == 0:
pytest.skip()
gdal.SetConfigOption('CPL_GS_ENDPOINT', 'http://127.0.0.1:%d/' % gdaltest.webserver_port)
gdal.SetConfigOption('GS_SECRET_ACCESS_KEY', 'GS_SECRET_ACCESS_KEY')
gdal.SetConfigOption('GS_ACCESS_KEY_ID', 'GS_ACCESS_KEY_ID')
def test_rda_test_presence():
gdaltest.rda_drv = gdal.GetDriverByName('RDA')
gdal.SetConfigOption('RDA_CACHE_DIR', '/vsimem/cache_dir')
gdal.SetConfigOption('GDBX_CONFIG_FILE', '')
if gdaltest.rda_drv is None:
pytest.skip()
(gdaltest.webserver_process, gdaltest.webserver_port) = webserver.launch(handler=webserver.DispatcherHttpHandler)
if gdaltest.webserver_port == 0:
pytest.skip()
def test_vsicurl_start_webserver():
gdaltest.webserver_process = None
gdaltest.webserver_port = 0
if not gdaltest.built_against_curl():
pytest.skip()
(gdaltest.webserver_process, gdaltest.webserver_port) = webserver.launch(handler=webserver.DispatcherHttpHandler)
if gdaltest.webserver_port == 0:
pytest.skip()