Skip to content
Permalink
Browse files
tests: fix 2 tests to work with GDAL >= 3.3
  • Loading branch information
rouault authored and nyalldawson committed May 25, 2021
1 parent 8bd755b commit d48806cf28567cb856fc747b57a738b3329e49ef
Showing with 8 additions and 5 deletions.
  1. +6 −3 tests/src/python/test_provider_ogr.py
  2. +2 −2 tests/src/python/test_provider_ogr_gpkg.py
@@ -1245,19 +1245,22 @@ def testHTTPRequestsOverrider(self):
'{ "type": "FeatureCollection", "features": [] }')
handler.add('GET', '/collections/foo/items?limit=10', 200, {'Content-Type': 'application/geo+json'},
'{ "type": "FeatureCollection", "features": [] }')
handler.add('GET', '/collections/foo/items?limit=10', 200, {'Content-Type': 'application/geo+json'},
'{ "type": "FeatureCollection", "features": [] }')
if int(gdal.VersionInfo('VERSION_NUM')) < GDAL_COMPUTE_VERSION(3, 3, 0):
handler.add('GET', '/collections/foo/items?limit=10', 200, {'Content-Type': 'application/geo+json'},
'{ "type": "FeatureCollection", "features": [] }')
with mockedwebserver.install_http_handler(handler):
vl = QgsVectorLayer("OAPIF:http://127.0.0.1:%d/collections/foo" % port, 'test', 'ogr')
assert vl.isValid()

# More complicated test using an anthentication configuration
authm = QgsApplication.authManager()
self.assertTrue(authm.setMasterPassword('masterpassword', True))
config = QgsAuthMethodConfig()
config.setName('Basic')
config.setMethod('Basic')
config.setConfig('username', 'username')
config.setConfig('password', 'password')
QgsApplication.authManager().storeAuthenticationConfig(config)
self.assertTrue(authm.storeAuthenticationConfig(config, True))

handler = mockedwebserver.SequentialHandler()
# Check that the authcfg gets expanded during the network request !
@@ -999,8 +999,8 @@ def testGeopackageManyLayers(self):
count = count_opened_filedescriptors(tmpfile)
if count > 0:
# We should have just 1 but for obscure reasons
# uniqueFields() leaves one behind
self.assertEqual(count, 2)
# uniqueFields() (sometimes?) leaves one behind
self.assertTrue(count == 1 or count == 2)

for i in range(70):
got = [feat for feat in vl.getFeatures()]

0 comments on commit d48806c

Please sign in to comment.