Skip to content

Commit 9c68837

Browse files
committed
Enable edit tests for Postgres provider
1 parent 8ccc511 commit 9c68837

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎tests/src/python/test_provider_postgres.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,21 @@ def execSQLCommand(self, sql):
7272
cur.close()
7373
self.con.commit()
7474

75+
def getEditableLayer(self):
76+
# create temporary table for edit tests
77+
self.execSQLCommand('DROP TABLE IF EXISTS qgis_test."editData" CASCADE')
78+
self.execSQLCommand('CREATE TABLE qgis_test."editData" ( pk SERIAL NOT NULL PRIMARY KEY, cnt integer, name text, name2 text, num_char text, geom public.geometry(Point, 4326))')
79+
self.execSQLCommand("INSERT INTO qgis_test.\"editData\" (pk, cnt, name, name2, num_char, geom) VALUES "
80+
"(5, -200, NULL, 'NuLl', '5', '0101000020E61000001D5A643BDFC751C01F85EB51B88E5340'),"
81+
"(3, 300, 'Pear', 'PEaR', '3', NULL),"
82+
"(1, 100, 'Orange', 'oranGe', '1', '0101000020E61000006891ED7C3F9551C085EB51B81E955040'),"
83+
"(2, 200, 'Apple', 'Apple', '2', '0101000020E6100000CDCCCCCCCC0C51C03333333333B35140'),"
84+
"(4, 400, 'Honey', 'Honey', '4', '0101000020E610000014AE47E17A5450C03333333333935340')")
85+
vl = QgsVectorLayer(
86+
self.dbconn + ' sslmode=disable key=\'pk\' srid=4326 type=POINT table="qgis_test"."editData" (geom) sql=',
87+
'test', 'postgres')
88+
return vl
89+
7590
def enableCompiler(self):
7691
QSettings().setValue('/qgis/compileExpressions', True)
7792

0 commit comments

Comments
 (0)