Skip to content
Permalink
Browse files

Tests for PG views PKs ordering

  • Loading branch information
elpaso authored and nyalldawson committed Jan 31, 2020
1 parent 900166f commit 4362c2827c79a4578a7b817383f905c51729bd62
Showing with 9 additions and 0 deletions.
  1. +9 −0 tests/src/python/test_qgsproviderconnection_postgres.py
@@ -208,6 +208,15 @@ def test_nulls(self):
self.assertEqual(conn.executeSql('SELECT NULL::text'), [[None]])
self.assertEqual(conn.executeSql('SELECT NULL::bytea'), [[None]])

def test_pk_cols_order(self):
"""Test that PKs are returned in consistent order: see GH #34167"""

md = QgsProviderRegistry.instance().providerMetadata(self.providerKey)
conn = md.createConnection(self.uri, {})
self.assertEqual(conn.table('qgis_test', 'bikes_view').primaryKeyColumns(), ['pk', 'name'])
self.assertEqual(conn.table('qgis_test', 'somedataview').primaryKeyColumns(), ['pk', 'cnt', 'name', 'name2', 'num_char', 'geom'])
self.assertEqual(conn.table('qgis_test', 'some_poly_data_view').primaryKeyColumns(), ['pk', 'geom'])


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

0 comments on commit 4362c28

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