Skip to content
Permalink
Browse files

Updates tests for source select registry

  • Loading branch information
elpaso committed Sep 4, 2017
1 parent 50e0a01 commit fd7bcb368dca400e85ef2a3ec1c15eedeef0a7c7
Showing with 15 additions and 0 deletions.
  1. +15 −0 tests/src/python/test_qgssourceselectprovider.py
@@ -120,13 +120,28 @@ def _testRegistry(self, registry):
# Get not existent by key
self.assertEqual(len(registry.providersByKey('Oh This Is Missing!')), 0)

def testRemoveProvider(self):
registry = QgsSourceSelectProviderRegistry()
registry.addProvider(ConcreteSourceSelectProvider())
registry.addProvider(ConcreteSourceSelectProvider2())
self.assertEqual(['MyTestProviderKey', 'MyName'], [p.name() for p in registry.providers() if p.providerKey().startswith('MyTestProviderKey')])

self.assertTrue(registry.removeProvider(registry.providerByName('MyName')))
self.assertEqual(['MyTestProviderKey'], [p.name() for p in registry.providers() if p.providerKey().startswith('MyTestProviderKey')])

self.assertTrue(registry.removeProvider(registry.providerByName('MyTestProviderKey')))
self.assertEqual([], [p.name() for p in registry.providers() if p.providerKey().startswith('MyTestProviderKey')])

def testRegistry(self):
registry = QgsSourceSelectProviderRegistry()
self._testRegistry(registry)

def testRegistrySingleton(self):
registry = QgsGui.sourceSelectProviderRegistry()
self._testRegistry(registry)
# Check that at least OGR and GDAL are here
self.assertTrue(registry.providersByKey('ogr'))
self.assertTrue(registry.providersByKey('gdal'))


if __name__ == '__main__':

0 comments on commit fd7bcb3

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