Skip to content
Permalink
Browse files

Add additional decodeUri tests

  • Loading branch information
nirvn committed Aug 16, 2018
1 parent 8a117af commit 3b861f22f95d7b550baf2fed1efcee13f422be51
Showing with 19 additions and 1 deletion.
  1. +11 −1 tests/src/python/test_provider_spatialite.py
  2. +8 −0 tests/src/python/test_qgsdelimitedtextprovider.py
@@ -20,7 +20,8 @@
import shutil
import tempfile

from qgis.core import (QgsVectorLayer,
from qgis.core import (QgsProviderRegistry,
QgsVectorLayer,
QgsVectorDataProvider,
QgsPointXY,
QgsFeature,
@@ -742,6 +743,15 @@ def _lessdigits(s):
self.assertEqual(subSet_vl.featureCount(), 8)
self.assertEqual(_lessdigits(subSet_vl.extent().toString()), unfiltered_extent)

def testDecodeUri(self):
"""Check that the provider URI decoding returns expected values"""

filename = '/home/to/path/test.db'
uri = 'dbname=\'{}\' table="test" (geometry) sql='.format(filename)
registry = QgsProviderRegistry.instance()
components = registry.decodeUri('spatialite', uri)
self.assertEqual(components['path'], filename)


if __name__ == '__main__':
unittest.main()
@@ -820,6 +820,14 @@ def test_042_no_detect_types_csvt(self):
requests = None
self.runTest(filename, requests, **params)

def test_043_decodeuri(self):
# URI decoding
filename = '/home/to/path/test.csv'
uri = 'file://{}?geomType=none'.format(filename)
registry = QgsProviderRegistry.instance()
components = registry.decodeUri('delimitedtext', uri)
self.assertEqual(components['path'], filename)


if __name__ == '__main__':
unittest.main()

0 comments on commit 3b861f2

Please sign in to comment.
You can’t perform that action at this time.