From faa4428eb052932cdf87d9a7d84a459cbd9de64a Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Wed, 29 Jun 2016 17:13:07 +0200 Subject: [PATCH] [ADD] test purging tables --- database_cleanup/tests/test_database_cleanup.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/database_cleanup/tests/test_database_cleanup.py b/database_cleanup/tests/test_database_cleanup.py index 3b7aa8d9c..f04609f1c 100644 --- a/database_cleanup/tests/test_database_cleanup.py +++ b/database_cleanup/tests/test_database_cleanup.py @@ -64,3 +64,11 @@ class TestDatabaseCleanup(TransactionCase): self.assertFalse(self.env['ir.module.module'].search([ ('name', '=', 'database_cleanup_test'), ])) + + # create an orphaned table + self.env.cr.execute('create table database_cleanup_test (test int)') + purge_tables = self.env['cleanup.purge.wizard.table'].create({}) + purge_tables.purge_all() + with self.assertRaises(ProgrammingError): + with self.registry.cursor() as cr: + self.env.cr.execute('select * from database_cleanup_test')