Did I find the right examples for you? yes no Crawl my project Python Jobs
All Samples(4) | Call(4) | Derive(0) | Import(0)
Fail the test if the expression is true.
src/o/p/openerp-core-7.0.406/openerp/tests/test_acl.py openerp-core(Download)
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('accuracy' in original_fields, "'accuracy' field must be properly visible before the test") self.assertNotEquals(view_arch.xpath("//field[@name='accuracy']"), [],
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('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")
def test_field_crud_restriction(self): "Read/Write RPC access to restricted field should be forbidden" # Verify the test environment first 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")
src/o/p/openerp-core-7.0.406/openerp/tests/test_orm.py openerp-core(Download)
# search as unprivileged user partners = self.partner.search(cr, uid2, []) self.assertFalse(p1 in partners, "W should not be visible...") self.assertTrue(p2 in partners, "... but Y should be visible")