test_qgsproviderconnection_postgres.py (QGIS-final-3_10_11) | : | test_qgsproviderconnection_postgres.py (QGIS-final-3_10_12) | ||
---|---|---|---|---|
skipping to change at line 14 | skipping to change at line 14 | |||
.. note:: This program is free software; you can redistribute it and/or modify | .. note:: This program is free software; you can redistribute it and/or modify | |||
it under the terms of the GNU General Public License as published by | it under the terms of the GNU General Public License as published by | |||
the Free Software Foundation; either version 2 of the License, or | the Free Software Foundation; either version 2 of the License, or | |||
(at your option) any later version. | (at your option) any later version. | |||
""" | """ | |||
__author__ = 'Alessandro Pasotti' | __author__ = 'Alessandro Pasotti' | |||
__date__ = '10/08/2019' | __date__ = '10/08/2019' | |||
__copyright__ = 'Copyright 2019, The QGIS Project' | __copyright__ = 'Copyright 2019, The QGIS Project' | |||
# This will get replaced with a git SHA1 when you do a git archive | # This will get replaced with a git SHA1 when you do a git archive | |||
__revision__ = 'd2171173e439b7a67b24646a15cc6111c3fafefb' | __revision__ = '75c848ffb1e501fbaaa28a09d168b88c7b58333c' | |||
import os | import os | |||
from test_qgsproviderconnection_base import TestPyQgsProviderConnectionBase | from test_qgsproviderconnection_base import TestPyQgsProviderConnectionBase | |||
from qgis.core import ( | from qgis.core import ( | |||
QgsWkbTypes, | QgsWkbTypes, | |||
QgsAbstractDatabaseProviderConnection, | QgsAbstractDatabaseProviderConnection, | |||
QgsProviderConnectionException, | QgsProviderConnectionException, | |||
QgsVectorLayer, | QgsVectorLayer, | |||
QgsProviderRegistry, | QgsProviderRegistry, | |||
QgsCoordinateReferenceSystem, | QgsCoordinateReferenceSystem, | |||
skipping to change at line 186 | skipping to change at line 186 | |||
self.assertTrue('Raster1' in table_names) | self.assertTrue('Raster1' in table_names) | |||
def test_pk_cols_order(self): | def test_pk_cols_order(self): | |||
"""Test that PKs are returned in consistent order: see GH #34167""" | """Test that PKs are returned in consistent order: see GH #34167""" | |||
md = QgsProviderRegistry.instance().providerMetadata(self.providerKey) | md = QgsProviderRegistry.instance().providerMetadata(self.providerKey) | |||
conn = md.createConnection(self.uri, {}) | conn = md.createConnection(self.uri, {}) | |||
self.assertEqual(self._table_by_name(conn.tables(), 'bikes_view').primar yKeyColumns(), ['pk', 'name']) | self.assertEqual(self._table_by_name(conn.tables(), 'bikes_view').primar yKeyColumns(), ['pk', 'name']) | |||
self.assertEqual(self._table_by_name(conn.tables(), 'some_poly_data_view ').primaryKeyColumns(), ['pk', 'geom']) | self.assertEqual(self._table_by_name(conn.tables(), 'some_poly_data_view ').primaryKeyColumns(), ['pk', 'geom']) | |||
def test_true_false(self): | ||||
"""Test returned values from BOOL queries""" | ||||
md = QgsProviderRegistry.instance().providerMetadata(self.providerKey) | ||||
conn = md.createConnection(self.uri, {}) | ||||
self.assertEqual(conn.executeSql('SELECT FALSE'), [[False]]) | ||||
self.assertEqual(conn.executeSql('SELECT TRUE'), [[True]]) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | |||
unittest.main() | unittest.main() | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 9 lines changed or added |