def installParcel(parcel, version=None): toolsMenu = schema.ns('osaf.views.main', parcel).ToolsMenu sharingMenu = schema.ns('osaf.views.main', parcel).ShareTestMenu MenuItem.update(parcel, None, blockName='_debug_separator_0', menuItemKind='Separator', parentBlock=toolsMenu) makeTestMenu(parcel, toolsMenu) makeDebugMenu(parcel, toolsMenu) MenuItem.update(parcel, None, blockName='_debug_separator_1', menuItemKind='Separator', parentBlock=sharingMenu) makeMeMenu(parcel, sharingMenu) MenuItem.update(parcel, None, blockName='_debug_separator_2', menuItemKind='Separator', parentBlock=sharingMenu) makeSharingMenu(parcel, sharingMenu) schema.parcel_for_module("debug.scripts", parcel.itsView)
def testAnnotateKind(self): kind_kind = schema.itemFor(schema.Kind, self.rv) CoreAnnotation(kind_kind).extraInfo = uw("Foo") self.assertEqual(CoreAnnotation(kind_kind).extraInfo, uw("Foo")) parcel = schema.parcel_for_module(__name__, self.rv) CoreAnnotation(kind_kind).otherItem = parcel self.assertEqual( list(getattr(parcel, __name__+".CoreAnnotation.otherItem.inverse")), [kind_kind] )
def testAnnotateKind(self): kind_kind = schema.itemFor(schema.Kind, self.rv) CoreAnnotation(kind_kind).extraInfo = uw("Foo") self.assertEqual(CoreAnnotation(kind_kind).extraInfo, uw("Foo")) parcel = schema.parcel_for_module(__name__, self.rv) CoreAnnotation(kind_kind).otherItem = parcel self.assertEqual( list( getattr(parcel, __name__ + ".CoreAnnotation.otherItem.inverse")), [kind_kind])
def testResetCache(self): # Parcel/kind/attr caches should be cleared between resets parcel1 = schema.parcel_for_module(this_module) kind1 = schema.itemFor(Dummy) attr1 = schema.itemFor(Dummy.attr) old = schema.reset() parcel2 = schema.parcel_for_module(this_module) kind2 = schema.itemFor(Dummy) attr2 = schema.itemFor(Dummy.attr) self.failIf(parcel2 is parcel1) self.failIf(kind2 is kind1) self.failIf(attr2 is attr1) # But switching back to an old state should restore the cache schema.reset(old) parcel3 = schema.parcel_for_module(this_module) kind3 = schema.itemFor(Dummy) attr3 = schema.itemFor(Dummy.attr) self.failUnless(parcel3 is parcel1) self.failUnless(attr3 is attr1) self.failUnless(attr3 is attr1)
def setUp(self): super(OOTBTestCase, self).setUp() # Make sure the osaf.app parcel is loaded schema.parcel_for_module("osaf.app", self.view)