Skip to content
Permalink
Browse files

Add tests

  • Loading branch information
pblottiere committed Oct 16, 2017
1 parent ac5d0f8 commit 6c6d83756752632f26efd56035d5cafaf2f69a2a
Showing with 16 additions and 0 deletions.
  1. +16 −0 tests/src/python/test_provider_postgres.py
@@ -391,6 +391,22 @@ def testKey(lyr, key, kfnames):
testKey(lyr, '"f1","F2","f3"', ['f1', 'F2', 'f3'])
testKey(lyr, None, ['id'])

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')
self.assertTrue(myvl.isValid())

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)


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

0 comments on commit 6c6d837

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