Skip to content

Commit

Permalink
Updates tests for source select registry
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Sep 4, 2017
1 parent 50e0a01 commit fd7bcb3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/src/python/test_qgssourceselectprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__':
Expand Down

0 comments on commit fd7bcb3

Please sign in to comment.