Skip to content
Permalink
Browse files

Added a test for the direct determination of geometry type/srid

  • Loading branch information
SebDieBln committed Nov 15, 2015
1 parent d9bbce6 commit cfa308d5ac956cff3c13603c51605092bba56da5
Showing with 8 additions and 0 deletions.
  1. +8 −0 tests/src/python/test_provider_postgres.py
@@ -59,6 +59,14 @@ def testDefaultValue(self):
assert self.provider.defaultValue(1) == NULL
assert self.provider.defaultValue(2) == '\'qgis\'::text'

def testQueryLayers(self):
def test_query(dbconn, query, key):
ql = QgsVectorLayer('%s srid=4326 table="%s" (geom) key=\'%s\' sql=' % (dbconn, query.replace('"', '\\"'), key), "testgeom", "postgres")
print query, key
assert(ql.isValid())

test_query(self.dbconn, '(SELECT NULL::integer "Id1", NULL::integer "Id2", NULL::geometry(Point, 4326) geom LIMIT 0)', '"Id1","Id2"')

def testWkbTypes(self):
def test_table(dbconn, table_name, wkt):
vl = QgsVectorLayer('%s srid=4326 table="qgis_test".%s (geom) sql=' % (dbconn, table_name), "testgeom", "postgres")

0 comments on commit cfa308d

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