Skip to content
Permalink
Browse files

Add test for #16833

Tested to pass with Python 2.7.13
  • Loading branch information
strk committed Jul 19, 2017
1 parent ff0df6d commit 2a572be73efc27697ea65a44f1bf4a39ce9df7f2
Showing with 13 additions and 0 deletions.
  1. +13 −0 python/plugins/db_manager/db_plugins/postgis/plugin_test.py
@@ -35,6 +35,7 @@

from db_manager.db_plugins.postgis.plugin import PostGisDBPlugin, PGRasterTable
from db_manager.db_plugins.postgis.plugin import PGDatabase
from db_manager.db_plugins.postgis.data_model import PGSqlResultModel
from db_manager.db_plugins.plugin import Table
from db_manager.db_plugins.postgis.connector import PostGisDBConnector

@@ -125,6 +126,18 @@ def check_rasterTableGdalURI(expected_dbname):

check_rasterTableGdalURI(expected_dbname)

# See http://issues.qgis.org/issues/16833
def test_unicodeInQuery(self):
os.environ['PGDATABASE'] = self.testdb
obj = QObject() # needs to be kept alive
database = PGDatabase(obj, QgsDataSourceUri())
self.assertIsInstance(database, PGDatabase)
sql = "SELECT 'é'::text"
res = database.sqlResultModel(sql, obj)
self.assertIsInstance(res, PGSqlResultModel)
dat = res.getData(0, 0)
self.assertEqual(dat, "é")


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

0 comments on commit 2a572be

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