Commit f7a1a858 authored by Hanno Schlichting's avatar Hanno Schlichting

Get rid of some more testing dependencies in AccessControl by moving...

Get rid of some more testing dependencies in AccessControl by moving integration tests into higher level packages
parent 82d43c24
...@@ -35,11 +35,8 @@ AccessControl ...@@ -35,11 +35,8 @@ AccessControl
- Test only dependencies: - Test only dependencies:
* OFS * OFS
* Products.PythonScripts
* Products.SiteErrorLog
* Testing * Testing
* transaction * transaction
* Zope2
DocumentTemplate DocumentTemplate
---------------- ----------------
......
<configure xmlns="http://namespaces.zope.org/zope" <configure xmlns="http://namespaces.zope.org/zope"
i18n_domain="Zope2"> i18n_domain="Zope2">
<include package="Zope2.App" file="meta.zcml"/>
<!-- Create permissions declared in ZCML if they don't exist already --> <!-- Create permissions declared in ZCML if they don't exist already -->
<subscriber <subscriber
for="zope.security.interfaces.IPermission for="zope.security.interfaces.IPermission
......
...@@ -4,11 +4,13 @@ $Id$ ...@@ -4,11 +4,13 @@ $Id$
""" """
import unittest import unittest
import Testing
import ZODB
from persistent import Persistent
from Acquisition import Implicit, aq_inner from Acquisition import Implicit, aq_inner
from AccessControl.Owned import Owned
class FauxUser(Implicit): class FauxUser(Implicit):
def __init__(self, id): def __init__(self, id):
...@@ -17,11 +19,13 @@ class FauxUser(Implicit): ...@@ -17,11 +19,13 @@ class FauxUser(Implicit):
def getId(self): def getId(self):
return self._id return self._id
class FauxUserFolder(Implicit): class FauxUserFolder(Implicit):
def getUserById(self, id, default): def getUserById(self, id, default):
return FauxUser(id) return FauxUser(id)
class FauxRoot(Implicit): class FauxRoot(Implicit):
def getPhysicalRoot(self): def getPhysicalRoot(self):
...@@ -46,26 +50,40 @@ class FauxRoot(Implicit): ...@@ -46,26 +50,40 @@ class FauxRoot(Implicit):
return obj return obj
class Folder(Implicit, Persistent, Owned):
def __init__(self, id):
self.id = id
self.names = set()
def _setObject(self, name, value):
setattr(self, name, value)
self.names.add(name)
def objectValues(self):
result = []
for name in self.names:
result.append(getattr(self, name))
return result
class OwnedTests(unittest.TestCase): class OwnedTests(unittest.TestCase):
def _getTargetClass(self): def _getTargetClass(self):
from AccessControl.Owned import Owned
return Owned return Owned
def _makeOne(self, *args, **kw): def _makeOne(self, *args, **kw):
return self._getTargetClass()(*args, **kw) return self._getTargetClass()(*args, **kw)
def _makeDummy(self, *args, **kw): def _makeDummy(self, *args, **kw):
from AccessControl.Owned import Owned
class Dummy(Implicit, Owned): class Dummy(Implicit, Owned):
pass pass
return Dummy(*args, **kw) return Dummy(*args, **kw)
def test_z3interfaces(self): def test_interfaces(self):
from AccessControl.interfaces import IOwned from AccessControl.interfaces import IOwned
from AccessControl.Owned import Owned
from zope.interface.verify import verifyClass from zope.interface.verify import verifyClass
verifyClass(IOwned, Owned) verifyClass(IOwned, Owned)
...@@ -182,7 +200,6 @@ class OwnershipChangeTests(unittest.TestCase): ...@@ -182,7 +200,6 @@ class OwnershipChangeTests(unittest.TestCase):
def setUp(self): def setUp(self):
from AccessControl.Owned import UnownableOwner from AccessControl.Owned import UnownableOwner
from AccessControl.User import UserFolder from AccessControl.User import UserFolder
from OFS.Folder import Folder
super(OwnershipChangeTests, self).setUp() super(OwnershipChangeTests, self).setUp()
self.root = FauxRoot() self.root = FauxRoot()
......
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