
charlie.clark at clark-consulting
Sep 18, 2010, 10:23 AM
Post #1 of 2
(562 views)
Permalink
|
|
Setting up a dummy vocabulary for a doctest
|
|
Hi, I'm writing tests for my replacement views. In the preferences form I use a vocabulary to list the possible skin choices. For testing the forms I'm generally using doctests to check the rendered HTML but I haven't been able to work out how to add get a dummy vocabulary to work with the test although it is correctly registered. This is from my doctest: Set up dummy skins vocabulary >>> from zope.schema.interfaces import IVocabularyFactory >>> from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm >>> terms = [SimpleTerm('default', 'default', 'default'), SimpleTerm('fancy', 'fancy', 'fancy')] >>> vocab = lambda: SimpleVocabulary(terms) >>> from zope.component import getSiteManager >>> sm = getSiteManager() >>> sm.registerUtility(vocab, IVocabularyFactory, u'cmf.portal_skins') But as soon as I call the preferences form I get (after logging in) >> browser.open("http://localhost/site/@@preferences.html") Error Value:\n unknown vocabulary: u\'cmf.portal_skins\' Any ideas? I've commited the doctest with the failing issues commented out. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Helmholtzstr. 20 Düsseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 _______________________________________________ Zope-CMF maillist - Zope-CMF [at] zope https://mail.zope.org/mailman/listinfo/zope-cmf See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
|