Browse Source

Merge pull request #1030 from hbrunn/8.0-database_cleanup-drop_table_cascade

[FIX] only purge our own table
pull/837/merge
Pedro M. Baeza 7 years ago
committed by GitHub
parent
commit
e93b6bccba
  1. 8
      database_cleanup/tests/test_database_cleanup.py

8
database_cleanup/tests/test_database_cleanup.py

@ -74,7 +74,13 @@ class TestDatabaseCleanup(TransactionCase):
# create an orphaned table # create an orphaned table
self.env.cr.execute('create table database_cleanup_test (test int)') self.env.cr.execute('create table database_cleanup_test (test int)')
purge_tables = self.env['cleanup.purge.wizard.table'].create({}) purge_tables = self.env['cleanup.purge.wizard.table'].create({})
purge_tables.purge_all()
self.assertIn(
'database_cleanup_test',
purge_tables.purge_line_ids.mapped('name')
)
purge_tables.purge_line_ids.filtered(
lambda x: x.name == 'database_cleanup_test'
).purge()
with self.assertRaises(ProgrammingError): with self.assertRaises(ProgrammingError):
with self.registry.cursor() as cr: with self.registry.cursor() as cr:
self.env.cr.execute('select * from database_cleanup_test') self.env.cr.execute('select * from database_cleanup_test')
Loading…
Cancel
Save