def setUp(self): self.root = DummyContext() zope.component.testing.setUp() xmlconfig.XMLConfig('meta.zcml', zope.component)() xmlconfig.XMLConfig('configure.zcml', zope.traversing)() xmlconfig.XMLConfig('configure.zcml', zope.publisher)() try: xmlconfig.XMLConfig('configure.zcml', zope.i18n)() except IOError: # Zope 2.10 xmlconfig.xmlconfig( StringIO(''' <configure xmlns="http://namespaces.zope.org/zope"> <utility provides="zope.i18n.interfaces.INegotiator" component="zope.i18n.negotiator.negotiator" /> <include package="zope.i18n.locales" /> </configure> ''')) xmlconfig.XMLConfig('meta.zcml', zope.i18n)() xmlconfig.XMLConfig('meta.zcml', zope.browserresource)() xmlconfig.XMLConfig('meta.zcml', z3c.form)() xmlconfig.XMLConfig('configure.zcml', collective.z3cform.datetimewidget)()
def setUp(test): testing.setUp(test) z3c.form.testing.setupFormDefaults() plone.z3cform.tests.setup_defaults() provideAdapter(DictionaryField) xmlconfig.XMLConfig('meta.zcml', zope.component)() xmlconfig.XMLConfig('meta.zcml', zope.security)() xmlconfig.XMLConfig('meta.zcml', zope.i18n)() xmlconfig.XMLConfig('meta.zcml', z3c.form)() xmlconfig.XMLConfig('meta.zcml', zope.browserresource)() xmlconfig.XMLConfig('configure.zcml', zope.i18n)() xmlconfig.XMLConfig('configure.zcml', z3c.form)() xmlconfig.XMLConfig('i18n.zcml', ZPublisher)() xmlconfig.XMLConfig('configure.zcml', Products.statusmessages)()
def test_simple_registration(self): i = TestView() self.assertIsNone(self.registry[i]) zcml = xmlconfig.XMLConfig("test1.zcml", z3c.caching.tests) zcml() i = TestView() self.assertEqual(self.registry[i], "first")
def setUp(self): self.root = setup.placefulSetUp(True) xmlconfig.XMLConfig('meta.zcml', zope.component)() xmlconfig.XMLConfig('meta.zcml', zope.security)() xmlconfig.XMLConfig('meta.zcml', zope.i18n)() try: xmlconfig.XMLConfig('configure.zcml', zope.i18n)() except IOError: # Zope 2.10 xmlconfig.xmlconfig( StringIO(''' <configure xmlns="http://namespaces.zope.org/zope"> <utility provides="zope.i18n.interfaces.INegotiator" component="zope.i18n.negotiator.negotiator" /> <include package="zope.i18n.locales" /> </configure> ''')) xmlconfig.XMLConfig('configure.zcml', plone.formwidget.datetime.z3cform)()
def test_declareType(self): zcml = xmlconfig.XMLConfig("test3.zcml", z3c.caching.tests) zcml() rules = list(self.registry.enumerateTypes()) rules.sort(key=lambda x: x.name) self.assertEqual(1, len(rules)) self.assertEqual("rule1", rules[0].name) self.assertEqual(u"Rule 1", rules[0].title) self.assertEqual(u"Rule one", rules[0].description)
def test_declareType_explicit_after(self): i = TestView() self.assertIsNone(self.registry[i]) self.registry.explicit = True zcml = xmlconfig.XMLConfig("test5.zcml", z3c.caching.tests) zcml() rules = list(self.registry.enumerateTypes()) rules.sort(key=lambda x: x.name) self.assertEqual(1, len(rules)) self.assertEqual("rule1", rules[0].name) self.assertEqual(u"Rule 1", rules[0].title) self.assertEqual(u"Rule one", rules[0].description) i = TestView() self.assertEqual(self.registry[i], "rule1")
def setUpDemo(test): placelesssetup.setUp(test) test.globs['this_directory'] = os.path.dirname(__file__) xmlconfig.XMLConfig('configure.zcml', quotationtool.workflow)()
def setUpZCML(test): setUp(test) xmlconfig.XMLConfig('configure.zcml', quotationtool.workflow)()
def test_declareType_multiple(self): zcml = xmlconfig.XMLConfig("test4.zcml", z3c.caching.tests) self.assertRaises(Exception, zcml) # ZCML conflict error
def test_conflicting_registrations(self): zcml = xmlconfig.XMLConfig("test2.zcml", z3c.caching.tests) self.assertRaises(Exception, zcml) # ZCML conflict error
def test_custom_discriminator(self): zcml = xmlconfig.XMLConfig("test4.zcml", z3c.zcmlhook.tests) zcml() self.assertEquals(['test_fn1', 'test_fn1'], testState.executions)
def test_invoke_conflict(self): zcml = xmlconfig.XMLConfig("test3.zcml", z3c.zcmlhook.tests) self.assertRaises(ConfigurationConflictError, zcml)
def test_invoke_order(self): zcml = xmlconfig.XMLConfig("test2.zcml", z3c.zcmlhook.tests) zcml() self.assertEquals(['test_fn2', 'test_fn1'], testState.executions)