[Checkins] SVN: zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_config.py Full coverage for z.c.config.GroupingContextDecorator.
Tres Seaver
cvs-admin at zope.org
Wed May 9 20:22:53 UTC 2012
Log message for revision 125769:
Full coverage for z.c.config.GroupingContextDecorator.
Changed:
U zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_config.py
-=-
Modified: zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_config.py
===================================================================
--- zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_config.py 2012-05-09 16:19:35 UTC (rev 125768)
+++ zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_config.py 2012-05-09 20:22:49 UTC (rev 125769)
@@ -1216,16 +1216,41 @@
from zope.configuration.config import GroupingContextDecorator
return GroupingContextDecorator
- def _makeOne(self, context=None):
+ def _makeOne(self, context=None, **kw):
if context is None:
- context = object()
- instance = self._getTargetClass()(context)
+ context = FauxContext()
+ instance = self._getTargetClass()(context, **kw)
instance.package = None # XXX to appease IConfigurationContext
return instance
- #TODO coverage
+ def test_ctor_no_kwargs(self):
+ context = FauxContext()
+ gcd = self._makeOne(context)
+ self.assertTrue(gcd.context is context)
+ def test_ctor_w_kwargs(self):
+ context = FauxContext()
+ gcd = self._makeOne(context, foo='bar', baz=42)
+ self.assertTrue(gcd.context is context)
+ self.assertEqual(gcd.foo, 'bar')
+ self.assertEqual(gcd.baz, 42)
+ def test_getattr_fetches_from_context_and_caches(self):
+ context = FauxContext()
+ gcd = self._makeOne(context)
+ context.foo = 'bar'
+ self.assertEqual(gcd.foo, 'bar')
+ self.assertTrue('foo' in gcd.__dict__)
+
+ def test_before(self):
+ gcd = self._makeOne()
+ gcd.before() #noraise
+
+ def test_after(self):
+ gcd = self._makeOne()
+ gcd.after() #noraise
+
+
class _ConformsToIDirectivesContext(object):
def test_class_conforms_to_IDirectivesContext(self):
More information about the checkins
mailing list