[FIX] base: remove test_ir_model, which causes bugs
authorRaphael Collet <rco@openerp.com>
Thu, 4 Sep 2014 12:59:45 +0000 (14:59 +0200)
committerRaphael Collet <rco@openerp.com>
Thu, 4 Sep 2014 12:59:45 +0000 (14:59 +0200)
The test in test_ir_model creates a custom model.  This causes a full reload of
the registry, which recursively installs the required modules while 'base' is
being tested.  As a side effect, it commits stuff from the database, so that
the effects of test_ir_model are actually not rolled back.

openerp/addons/base/tests/__init__.py
openerp/addons/base/tests/test_ir_model.py [deleted file]

index 26688f1..c597542 100644 (file)
@@ -7,7 +7,6 @@ import test_expression
 import test_func
 import test_ir_actions
 import test_ir_attachment
-import test_ir_model
 import test_ir_filters
 import test_ir_sequence
 import test_ir_values
diff --git a/openerp/addons/base/tests/test_ir_model.py b/openerp/addons/base/tests/test_ir_model.py
deleted file mode 100644 (file)
index c18c74e..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-import unittest2
-
-import openerp.tests.common as common
-
-class test_ir_model(common.TransactionCase):
-
-    def test_00(self):
-        # Create some custom model and fields
-        cr, uid, context = self.cr, self.uid, {}
-
-        ir_model = self.registry('ir.model')
-        ir_model_fields = self.registry('ir.model.fields')
-        ir_model_access = self.registry('ir.model.access')
-        candy_model_id = ir_model.create(cr, uid, {
-                'name': 'Candies',
-                'model': 'x_candy',
-                'info': 'List of candies',
-                'state': 'manual',
-            }, context=context)
-        # security rule to avoid warning
-        ir_model_access.create(cr, uid, {
-                'name': 'Candies are for everybody',
-                'model_id': candy_model_id,
-                'perm_read': True,
-                'perm_write': True,
-                'perm_create': True,
-                'perm_unlink': True,
-            })
-
-        assert self.registry('x_candy'), "Custom model not present in registry"
-
-        ir_model_fields.create(cr, uid, {
-                'name': 'x_name',
-                'field_description': 'Name',
-                'model_id': candy_model_id,
-                'state': 'manual',
-                'ttype': 'char',
-            }, context=context)
-
-        assert 'x_name' in self.registry('x_candy')._all_columns, "Custom field not present in registry"
-        assert self.registry('x_candy')._rec_name == 'x_name', "The _rec_name on custom model was not updated"
-
-if __name__ == '__main__':
-    unittest2.main()