Back to index

plone3  3.1.7
common.py
Go to the documentation of this file.
00001 #
00002 # ArchetypesTestCase and ArcheSiteTestCase classes
00003 #
00004 
00005 # $Id: common.py 7768 2007-03-18 23:38:08Z nouri $
00006 
00007 from Testing import ZopeTestCase
00008 
00009 class TestPreconditionFailed(Exception):
00010     """ Some modules are missing or other preconditions have failed """
00011     def __init__(self, test, precondition):
00012         self.test = test
00013         self.precondition = precondition
00014 
00015     def __str__(self):
00016         return ("Some modules are missing or other preconditions "
00017                 "for the test %s have failed: '%s' "
00018                 % (self.test, self.precondition))
00019 
00020 def mkDummyInContext(klass, oid, context, schema=None):
00021     gen_class(klass, schema)
00022     dummy = klass(oid=oid).__of__(context)
00023     setattr(context, oid, dummy)
00024     dummy.initializeArchetype()
00025     return dummy
00026