[Zope-CVS] CVS: Products/Basket/tests - testBasket.py:1.27
Chris McDonough
chrism at plope.com
Thu Nov 10 16:48:09 EST 2005
Update of /cvs-repository/Products/Basket/tests
In directory cvs.zope.org:/tmp/cvs-serv9553/tests
Modified Files:
testBasket.py
Log Message:
Add registerZClass method to EggProductContext.
=== Products/Basket/tests/testBasket.py 1.26 => 1.27 ===
--- Products/Basket/tests/testBasket.py:1.26 Thu Nov 10 14:37:14 2005
+++ Products/Basket/tests/testBasket.py Thu Nov 10 16:48:08 2005
@@ -63,8 +63,6 @@
self.Control_Panel.Products.id = 'Products'
def _manage_remove_product_meta_type(self, product):
- # hahahahahaha
- # hahahahahahahaahaha
pass
class DummyProductContext:
@@ -78,6 +76,17 @@
self.arg = arg
self.kw = kw
+class DummyZClassModule:
+
+ def __init__(self, meta_type=None):
+ if meta_type:
+ self.meta_type = meta_type
+ self.__name__ = 'DummyZClassName'
+
+class DummyZClass:
+ def __init__(self, module):
+ self._zclass_ = module
+
class IDummyRegisterableClass(Interface):
pass
@@ -436,6 +445,16 @@
if not thing.has_key('test_chicken'):
L.append(thing)
Products.meta_types = tuple(L)
+ if hasattr(Products, 'meta_classes'):
+ dummyzs = [ x[0] for x in Products.meta_classes if
+ x.startswith('Dummy') ]
+ for key in dummyzs:
+ del Products.meta_classes[dummy]
+ if hasattr(Products, 'meta_class_info'):
+ dummyzs = [x for x in Products.meta_class_info if
+ x.startswith('Dummy') ]
+ for key in dummyzs:
+ del Products.meta_class_info[dummy]
Products.__ac_permissions__ = ()
from Globals import ApplicationDefaultPermissions as g
for k, v in g.__dict__.items():
@@ -716,6 +735,20 @@
icon = 'fixtures/new.gif')
misc = getattr(OFS.misc_.misc_, 'DummyProduct')
self.assertEqual(misc['new.gif'].__class__.__name__, 'ImageResource')
+
+ def test_registerZClass(self):
+ app = DummyApp()
+ products = app.Control_Panel.Products
+ package = DummyPackage()
+ context = self._makeOne('DummyProduct', dummy_initializer, app, package,
+ 'eggname')
+ dummyz = DummyZClass(DummyZClassModule())
+ context.registerZClass(dummyz)
+ key = 'Basket.tests.testBasket/DummyZClassName'
+ self.assertEqual(Products.meta_classes[key].__class__, DummyZClass)
+ self.assertEqual(Products.meta_class_info[key],
+ 'Basket: DummyZClassName')
+
class TestEggProduct(unittest.TestCase):
def _getTargetClass(self):
More information about the Zope-CVS
mailing list