Skip to content

Commit

Permalink
More tolerant test
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 9, 2020
1 parent 85e1fbe commit 643b169
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/src/python/test_qgsdatabasetablecombobox.py
Expand Up @@ -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())]
Expand Down Expand Up @@ -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(), '')
Expand Down

0 comments on commit 643b169

Please sign in to comment.