Ignore:
Timestamp:
Apr 29, 2017, 5:57:19 AM (2 years ago)
Author:
cito
Message:

Stricter large object error checks, with unit tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/test_classic_largeobj.py

    r770 r909  
    374374        unlink()
    375375        self.assertIsNone(self.obj.oid)
     376        # unlinking after object has been already unlinked
     377        self.assertRaises(pg.IntegrityError, unlink)
     378
     379    def testUnlinkInexistent(self):
     380        unlink = self.obj.unlink
     381        self.obj.open(pg.INV_WRITE)
     382        self.obj.close()
     383        self.pgcnx.query('select lo_unlink(%d)' % self.obj.oid)
     384        self.assertRaises(IOError, unlink)
    376385
    377386    def testSize(self):
     
    446455        self.assertEqual(r, data)
    447456
     457    def testExportInExistent(self):
     458        export = self.obj.export
     459        f = tempfile.NamedTemporaryFile()
     460        self.obj.open(pg.INV_WRITE)
     461        self.obj.close()
     462        self.pgcnx.query('select lo_unlink(%d)' % self.obj.oid)
     463        self.assertRaises(IOError, export, f.name)
     464        f.close()
     465
    448466
    449467if __name__ == '__main__':
Note: See TracChangeset for help on using the changeset viewer.