Skip to content
Permalink
Browse files
fix test position
  • Loading branch information
elpaso authored and nyalldawson committed Nov 1, 2021
1 parent adda806 commit d304ad8b1ff4ee911dca5d2c935551580c3754f6
Showing with 12 additions and 12 deletions.
  1. +12 −12 tests/src/python/test_provider_postgres.py
@@ -2063,6 +2063,18 @@ def testReadExtentOnTable(self):
vl2.readLayerXml(elem, QgsReadWriteContext())
self.assertEqual(vl2.extent(), originalExtent)

def testPreparedFailure(self):
"""Test error from issue GH #45100"""

layer = self.getEditableLayerWithCheckConstraint()
self.assertTrue(layer.startEditing())
old_value = layer.getFeature(1).attribute('i_will_fail_on_no_name')
layer.changeAttributeValue(1, 1, 'no name')
layer.changeGeometry(1, QgsGeometry.fromWkt('point(7 45)'))
self.assertFalse(layer.commitChanges())
layer.changeAttributeValue(1, 1, old_value)
self.assertTrue(layer.commitChanges())

def testDeterminePkey(self):
"""Test primary key auto-determination"""

@@ -3199,18 +3211,6 @@ def testPkeyIntArray(self):
self.assertTrue(feat.isValid())
self.assertEqual(feat["name"], "test")

def testPreparedFailure(self):
"""Test error from issue GH #45100"""

layer = self.getEditableLayerWithCheckConstraint()
self.assertTrue(layer.startEditing())
old_value = layer.getFeature(1).attribute('i_will_fail_on_no_name')
layer.changeAttributeValue(1, 1, 'no name')
layer.changeGeometry(1, QgsGeometry.fromWkt('point(7 45)'))
self.assertFalse(layer.commitChanges())
layer.changeAttributeValue(1, 1, old_value)
self.assertTrue(layer.commitChanges())


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

0 comments on commit d304ad8

Please sign in to comment.