Skip to content
Permalink
Browse files

More tolerant test

  • Loading branch information
nyalldawson committed Mar 8, 2020
1 parent 85e1fbe commit 643b1696098aa1ce1c7a773a93c4c9c40ed3dc3f
Showing with 9 additions and 6 deletions.
  1. +9 −6 tests/src/python/test_qgsdatabasetablecombobox.py
@@ -55,15 +55,17 @@ def testCombo(self):
md.saveConnection(conn, 'mycon')

m = QgsDatabaseTableComboBox('postgres', 'mycon')
spy = QSignalSpy(m.tableChanged)
self.assertGreaterEqual(m.comboBox().count(), 3)

text = [m.comboBox().itemText(i) for i in range(m.comboBox().count())]
self.assertIn('information_schema.attributes', text)
self.assertIn('qgis_test.some_poly_data', text)
self.assertLess(text.index('information_schema.attributes'), text.index('qgis_test.some_poly_data'))
self.assertEqual(m.currentSchema(), 'information_schema')
self.assertEqual(m.currentTable(), '_pg_foreign_data_wrappers')
self.assertTrue(m.currentSchema())
self.assertTrue(m.currentTable())

m.setSchema('information_schema')
spy = QSignalSpy(m.tableChanged)

m.setSchema('qgis_test')
text = [m.comboBox().itemText(i) for i in range(m.comboBox().count())]
@@ -141,15 +143,16 @@ def testComboAllSchemas(self):
md.saveConnection(conn, 'mycon2')

m = QgsDatabaseTableComboBox('postgres', 'mycon2')
spy = QSignalSpy(m.tableChanged)
self.assertGreaterEqual(m.comboBox().count(), 3)

text = [m.comboBox().itemText(i) for i in range(m.comboBox().count())]
self.assertIn('information_schema.attributes', text)
self.assertIn('qgis_test.some_poly_data', text)
self.assertLess(text.index('information_schema.attributes'), text.index('qgis_test.some_poly_data'))
self.assertEqual(m.currentSchema(), 'information_schema')
self.assertEqual(m.currentTable(), '_pg_foreign_data_wrappers')
self.assertTrue(m.currentSchema())
self.assertTrue(m.currentTable())

spy = QSignalSpy(m.tableChanged)

m.setTable('')
self.assertEqual(m.currentTable(), '')

0 comments on commit 643b169

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