[FIX] res_currency: update linked tests
bzr revid: mat@openerp.com-20130731111054-g5p094izprzok3eo
This commit is contained in:
parent
fc2eb46b40
commit
3393aa645c
|
@ -29,18 +29,18 @@ class TestACL(common.TransactionCase):
|
|||
view_arch = etree.fromstring(form_view.get('arch'))
|
||||
has_tech_feat = self.res_users.has_group(self.cr, self.demo_uid, GROUP_TECHNICAL_FEATURES)
|
||||
self.assertFalse(has_tech_feat, "`demo` user should not belong to the restricted group before the test")
|
||||
self.assertTrue('rate' in original_fields, "'rate' field must be properly visible before the test")
|
||||
self.assertNotEquals(view_arch.xpath("//field[@name='rate']"), [],
|
||||
"Field 'rate' must be found in view definition before the test")
|
||||
self.assertTrue('accuracy' in original_fields, "'accuracy' field must be properly visible before the test")
|
||||
self.assertNotEquals(view_arch.xpath("//field[@name='accuracy']"), [],
|
||||
"Field 'accuracy' must be found in view definition before the test")
|
||||
|
||||
# Restrict access to the field and check it's gone
|
||||
self.res_currency._columns['rate'].groups = GROUP_TECHNICAL_FEATURES
|
||||
self.res_currency._columns['accuracy'].groups = GROUP_TECHNICAL_FEATURES
|
||||
fields = self.res_currency.fields_get(self.cr, self.demo_uid, [])
|
||||
form_view = self.res_currency.fields_view_get(self.cr, self.demo_uid, False, 'form')
|
||||
view_arch = etree.fromstring(form_view.get('arch'))
|
||||
self.assertFalse('rate' in fields, "'rate' field should be gone")
|
||||
self.assertEquals(view_arch.xpath("//field[@name='rate']"), [],
|
||||
"Field 'rate' must not be found in view definition")
|
||||
self.assertFalse('accuracy' in fields, "'accuracy' field should be gone")
|
||||
self.assertEquals(view_arch.xpath("//field[@name='accuracy']"), [],
|
||||
"Field 'accuracy' must not be found in view definition")
|
||||
|
||||
# Make demo user a member of the restricted group and check that the field is back
|
||||
self.tech_group.write({'users': [(4, self.demo_uid)]})
|
||||
|
@ -50,13 +50,13 @@ class TestACL(common.TransactionCase):
|
|||
view_arch = etree.fromstring(form_view.get('arch'))
|
||||
#import pprint; pprint.pprint(fields); pprint.pprint(form_view)
|
||||
self.assertTrue(has_tech_feat, "`demo` user should now belong to the restricted group")
|
||||
self.assertTrue('rate' in fields, "'rate' field must be properly visible again")
|
||||
self.assertNotEquals(view_arch.xpath("//field[@name='rate']"), [],
|
||||
"Field 'rate' must be found in view definition again")
|
||||
self.assertTrue('accuracy' in fields, "'accuracy' field must be properly visible again")
|
||||
self.assertNotEquals(view_arch.xpath("//field[@name='accuracy']"), [],
|
||||
"Field 'accuracy' must be found in view definition again")
|
||||
|
||||
#cleanup
|
||||
self.tech_group.write({'users': [(3, self.demo_uid)]})
|
||||
self.res_currency._columns['rate'].groups = False
|
||||
self.res_currency._columns['accuracy'].groups = False
|
||||
|
||||
@mute_logger('openerp.osv.orm')
|
||||
def test_field_crud_restriction(self):
|
||||
|
|
Loading…
Reference in New Issue