Skip to content

Commit

Permalink
tests: fix 2 tests to work with GDAL >= 3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault authored and nyalldawson committed May 25, 2021
1 parent 8bd755b commit d48806c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions tests/src/python/test_provider_ogr.py
Expand Up @@ -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 !
Expand Down
4 changes: 2 additions & 2 deletions tests/src/python/test_provider_ogr_gpkg.py
Expand Up @@ -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()]
Expand Down

0 comments on commit d48806c

Please sign in to comment.