Commit 089c3d05 authored by Romain Courteaud's avatar Romain Courteaud

Test checked_permission parameter with category setter


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16547 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2f47d8c7
...@@ -1378,6 +1378,14 @@ class TestPropertySheet: ...@@ -1378,6 +1378,14 @@ class TestPropertySheet:
checked_permission = 'View' checked_permission = 'View'
beta.manage_permission(checked_permission, roles=[], acquire=0) beta.manage_permission(checked_permission, roles=[], acquire=0)
gamma_id = "gamma"
gamma_title = "Gamma System"
gamma = region_category.newContent(
portal_type = "Category",
id = gamma_id,
title = gamma_title, )
gamma_path = gamma.getCategoryRelativeUrl()
# Make sure categories are reindexed # Make sure categories are reindexed
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
...@@ -1488,120 +1496,119 @@ class TestPropertySheet: ...@@ -1488,120 +1496,119 @@ class TestPropertySheet:
# Check setCategoryValue accessor # Check setCategoryValue accessor
foo.setRegionValue(beta) foo.setRegionValue(beta)
self.assertEquals(beta_path, foo.getRegion()) self.assertEquals(beta_path, foo.getRegion())
# XXX Not yet implemented foo.setRegionValue(None)
# foo.setRegionValue(None) foo.setRegionValue(gamma,
# foo.setRegionValue(beta, checked_permission=checked_permission)
# checked_permission=checked_permission) self.assertSameSet([gamma_path], foo.getRegionList())
# self.assertEquals(None, foo.getRegion()) foo.setRegionValue(beta)
# foo.setRegionValue(beta) foo.setRegionValue(gamma,
# foo.setRegionValue(beta, checked_permission=checked_permission)
# checked_permission=checked_permission) self.assertSameSet([beta_path, gamma_path], foo.getRegionList())
# self.assertEquals('', foo.getRegion())
foo.setRegionValue(None) foo.setRegionValue(None)
self.assertEquals(None, foo.getRegion()) self.assertEquals(None, foo.getRegion())
# Check setDefaultCategoryValue accessor # Check setDefaultCategoryValue accessor
foo.setDefaultRegionValue(beta) foo.setDefaultRegionValue(beta)
self.assertEquals(beta_path, foo.getRegion()) self.assertEquals(beta_path, foo.getRegion())
# XXX Not yet implemented # XXX setDefaultValue seems buggy when passing None
# foo.setDefaultRegionValue(None) # foo.setDefaultRegionValue(None)
# foo.setDefaultRegionValue(beta, foo.setRegionValue(None)
# checked_permission=checked_permission) foo.setDefaultRegionValue(gamma,
# self.assertEquals('', foo.getRegion()) checked_permission=checked_permission)
# foo.setDefaultRegionValue(beta_path) self.assertEquals(gamma_path, foo.getRegion())
# foo.setDefaultRegionValue(beta_path, foo.setDefaultRegionValue(beta_path)
# checked_permission=checked_permission) foo.setDefaultRegionValue(gamma_path,
# self.assertEquals('', foo.getRegion()) checked_permission=checked_permission)
self.assertEquals(gamma_path, foo.getDefaultRegion())
self.assertSameSet([beta_path, gamma_path], foo.getRegionList())
foo.setRegionValue(None) foo.setRegionValue(None)
self.assertEquals(None, foo.getRegion()) self.assertEquals(None, foo.getRegion())
# Check setCategory accessor # Check setCategory accessor
foo.setRegion(beta_path) foo.setRegion(beta_path)
self.assertEquals(beta_path, foo.getRegion()) self.assertEquals(beta_path, foo.getRegion())
# XXX Not yet implemented foo.setRegion(None)
# foo.setRegion('') foo.setRegion(gamma_path,
# foo.setRegion(beta_path, checked_permission=checked_permission)
# checked_permission=checked_permission) self.assertEquals(gamma_path, foo.getRegion())
# self.assertEquals('', foo.getRegion()) foo.setRegion(beta_path)
# foo.setRegion(beta_path) foo.setRegion(gamma_path,
# foo.setRegion(beta_path, checked_permission=checked_permission)
# checked_permission=checked_permission) self.assertSameSet([beta_path, gamma_path], foo.getRegionList())
# self.assertEquals('', foo.getRegion()) self.assertEquals(gamma_path,
foo.getRegion(checked_permission=checked_permission))
foo.setRegionValue(None) foo.setRegionValue(None)
self.assertEquals(None, foo.getRegion()) self.assertEquals(None, foo.getRegion())
# Check setDefaultCategory accessor # Check setDefaultCategory accessor
foo.setDefaultRegion(beta_path) foo.setDefaultRegion(beta_path)
self.assertEquals(beta_path, foo.getRegion()) self.assertEquals(beta_path, foo.getRegion())
# XXX Not yet implemented foo.setRegion(None)
# foo.setDefaultRegion('') foo.setDefaultRegion(gamma_path,
# foo.setDefaultRegion(beta_path, checked_permission=checked_permission)
# checked_permission=checked_permission) self.assertEquals(gamma_path, foo.getRegion())
# self.assertEquals('', foo.getRegion()) foo.setDefaultRegion(beta_path)
# foo.setDefaultRegion(beta_path) foo.setDefaultRegion(gamma_path,
# foo.setDefaultRegion(beta_path, checked_permission=checked_permission)
# checked_permission=checked_permission) self.assertSameSet([beta_path, gamma_path], foo.getRegionList())
# self.assertEquals('', foo.getRegion()) self.assertEquals(gamma_path,
foo.getDefaultRegion())
foo.setRegionValue(None) foo.setRegionValue(None)
self.assertEquals(None, foo.getRegion()) self.assertEquals(None, foo.getRegion())
# Check setCategoryList accessor # Check setCategoryList accessor
foo.setRegionList([beta_path]) foo.setRegionList([beta_path])
self.assertEquals(beta_path, foo.getRegion()) self.assertEquals(beta_path, foo.getRegion())
# XXX Not yet implemented foo.setRegionList([])
# foo.setRegionList([]) foo.setRegionList([gamma_path],
# foo.setRegionList([beta_path], checked_permission=checked_permission)
# checked_permission=checked_permission) self.assertEquals(gamma_path, foo.getRegion())
# self.assertEquals('', foo.getRegion()) foo.setRegionList([beta_path])
# foo.setRegionList([beta_path]) foo.setRegionList([gamma_path],
# foo.setRegionList([beta_path], checked_permission=checked_permission)
# checked_permission=checked_permission) self.assertSameSet([beta_path, gamma_path], foo.getRegionList())
# self.assertEquals('', foo.getRegion())
foo.setRegionValue(None) foo.setRegionValue(None)
self.assertEquals(None, foo.getRegion()) self.assertEquals(None, foo.getRegion())
# Check setCategoryValueList accessor # Check setCategoryValueList accessor
foo.setRegionValueList([beta]) foo.setRegionValueList([beta])
self.assertEquals(beta_path, foo.getRegion()) self.assertEquals(beta_path, foo.getRegion())
# XXX Not yet implemented foo.setRegionList([])
# foo.setRegionList([]) foo.setRegionValueList([gamma],
# foo.setRegionValueList([beta], checked_permission=checked_permission)
# checked_permission=checked_permission) self.assertEquals(gamma_path, foo.getRegion())
# self.assertEquals('', foo.getRegion()) foo.setRegionValueList([beta])
# foo.setRegionValueList([beta]) foo.setRegionValueList([gamma],
# foo.setRegionValueList([beta], checked_permission=checked_permission)
# checked_permission=checked_permission) self.assertSameSet([beta_path, gamma_path], foo.getRegionList())
# self.assertEquals('', foo.getRegion())
foo.setRegionValue(None) foo.setRegionValue(None)
self.assertEquals(None, foo.getRegion()) self.assertEquals(None, foo.getRegion())
# Check setCategorySet accessor # Check setCategorySet accessor
foo.setRegionSet([beta_path]) foo.setRegionSet([beta_path])
self.assertEquals(beta_path, foo.getRegion()) self.assertEquals(beta_path, foo.getRegion())
# XXX Not yet implemented foo.setRegionSet([])
# foo.setRegionSet(set()) foo.setRegionSet([gamma_path],
# foo.setRegionSet(set(beta_path), checked_permission=checked_permission)
# checked_permission=checked_permission) self.assertEquals(gamma_path, foo.getRegion())
# self.assertEquals('', foo.getRegion()) foo.setRegionSet([beta_path])
# foo.setRegionSet(set(beta_path)) foo.setRegionSet([gamma_path],
# foo.setRegionSet(set(beta_path), checked_permission=checked_permission)
# checked_permission=checked_permission) self.assertSameSet([beta_path, gamma_path], foo.getRegionList())
# self.assertEquals('', foo.getRegion())
foo.setRegionValue(None) foo.setRegionValue(None)
self.assertEquals(None, foo.getRegion()) self.assertEquals(None, foo.getRegion())
# Check setCategoryValueSet accessor # Check setCategoryValueSet accessor
foo.setRegionValueSet([beta]) foo.setRegionValueSet([beta])
self.assertEquals(beta_path, foo.getRegion()) self.assertEquals(beta_path, foo.getRegion())
# XXX Not yet implemented foo.setRegionSet([])
# foo.setRegionSet(set()) foo.setRegionValueSet([gamma],
# foo.setRegionValueSet(set(beta), checked_permission=checked_permission)
# checked_permission=checked_permission) self.assertEquals(gamma_path, foo.getRegion())
# self.assertEquals('', foo.getRegion()) foo.setRegionValueSet([beta])
# foo.setRegionValueSet(set(beta)) foo.setRegionValueSet([gamma],
# foo.setRegionValueSet(set(beta), checked_permission=checked_permission)
# checked_permission=checked_permission) self.assertSameSet([beta_path, gamma_path], foo.getRegionList())
# self.assertEquals('', foo.getRegion())
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment