[FIX] base: remove test_ir_model, which causes bugs
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.
This commit is contained in:
parent
bb007dd040
commit
070f28dce6
|
@ -7,7 +7,6 @@ import test_expression
|
||||||
import test_func
|
import test_func
|
||||||
import test_ir_actions
|
import test_ir_actions
|
||||||
import test_ir_attachment
|
import test_ir_attachment
|
||||||
import test_ir_model
|
|
||||||
import test_ir_filters
|
import test_ir_filters
|
||||||
import test_ir_sequence
|
import test_ir_sequence
|
||||||
import test_ir_values
|
import test_ir_values
|
||||||
|
|
|
@ -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()
|
|
Loading…
Reference in New Issue