Skip to content

Commit

Permalink
Make TestPyQgsPostgresProvider.testPktUpdateBigintPk idempotent
Browse files Browse the repository at this point in the history
References #45417
  • Loading branch information
strk committed Oct 5, 2021
1 parent bb30046 commit 41f1924
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/src/python/test_provider_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,9 @@ def testPktUpdateBigintPk(self):
"bigint_pk", "postgres")
flds = vl.fields()

# Backup test table (will be edited)
self.backupTable('qgis_test', 'bigint_pk')

self.assertTrue(vl.isValid())

vl.startEditing()
Expand Down Expand Up @@ -763,6 +766,9 @@ def testPktUpdateBigintPk(self):
statuses[3] = 1
self.assertTrue(all(x == 1 for x in statuses))

# Restore test table
self.restoreTable('qgis_test', 'bigint_pk')

def testPktUpdateBigintPkNonFirst(self):
"""Test if we can update objects with positive, zero and negative bigint PKs in tables whose PK is not the first field"""
vl = QgsVectorLayer('{} sslmode=disable srid=4326 key="pk" table="qgis_test".{} (geom)'.format(self.dbconn,
Expand Down

0 comments on commit 41f1924

Please sign in to comment.