Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add tests
  • Loading branch information
pblottiere committed Oct 6, 2017
1 parent 924ce81 commit ea96031
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tests/src/python/test_provider_postgres.py
Expand Up @@ -32,7 +32,8 @@
QgsTransactionGroup,
QgsReadWriteContext,
QgsRectangle,
QgsDefaultValue
QgsDefaultValue,
QgsDataSourceUri
)
from qgis.gui import QgsGui
from qgis.PyQt.QtCore import QDate, QTime, QDateTime, QVariant, QDir, QObject
Expand Down Expand Up @@ -847,6 +848,27 @@ def receive(self, msg):

self.assertTrue(ok)

def testStyleDatabaseWithService(self):

myconn = 'service=\'qgis_test\''
if 'QGIS_PGTEST_DB' in os.environ:
myconn = os.environ['QGIS_PGTEST_DB']
myvl = QgsVectorLayer(myconn + ' sslmode=disable key=\'pk\' srid=4326 type=POINT table="qgis_test"."someData" (geom) sql=', 'test', 'postgres')

styles = myvl.listStylesInDatabase()
ids = styles[1]
self.assertEqual(len(ids), 0)

myvl.saveStyleToDatabase('mystyle', '', False, '')
styles = myvl.listStylesInDatabase()
ids = styles[1]
self.assertEqual(len(ids), 1)

myvl.deleteStyleFromDatabase(ids[0])
styles = myvl.listStylesInDatabase()
ids = styles[1]
self.assertEqual(len(ids), 0)


class TestPyQgsPostgresProviderCompoundKey(unittest.TestCase, ProviderTestCase):

Expand Down

0 comments on commit ea96031

Please sign in to comment.