Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added a test for the direct determination of geometry type/srid
  • Loading branch information
SebDieBln committed Nov 15, 2015
1 parent d9bbce6 commit cfa308d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/src/python/test_provider_postgres.py
Expand Up @@ -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")
Expand Down

0 comments on commit cfa308d

Please sign in to comment.