コード例 #1
0
 def test_Indices(self):
     from z3c.indexer.interfaces import IIndex
     from quotationtool.site.site import QuotationtoolSite
     self.root_folder['quotationtool'] = site = QuotationtoolSite()
     oids = zope.component.queryUtility(IIndex,
                                        name='workflow-relevant-oids',
                                        context=site)
     self.assertTrue(oids is not None)
     self.assertTrue(
         oids is site.getSiteManager()['default']['workflow-relevant-oids'])
コード例 #2
0
 def test_CategoriesContainer(self):
     """ Test if container is created on a new site event."""
     from quotationtool.site.site import QuotationtoolSite
     self.root['quotationtool'] = site = QuotationtoolSite()
     self.assertTrue('categories' in site.keys())
     from quotationtool.categorization.categoriescontainer import CategoriesContainer
     self.assertTrue(isinstance(site['categories'], CategoriesContainer))
     from quotationtool.categorization.interfaces import ICategoriesContainer
     ut = zope.component.getUtility(ICategoriesContainer, context=site)
     self.assertTrue(ut is site['categories'])
コード例 #3
0
 def test_CatalogCreation(self):
     from zope.container.btree import BTreeContainer
     from quotationtool.site.site import QuotationtoolSite
     root = BTreeContainer()
     root['site'] = site = QuotationtoolSite()
     from zc.relation.interfaces import ICatalog
     cat = zope.component.queryUtility(
         ICatalog,
         context = site, 
         default = None)
     self.assertTrue(cat is not None)
コード例 #4
0
 def test_WorkFlowContainer(self):
     from quotationtool.site.site import QuotationtoolSite
     self.root_folder['quotationtool'] = site = QuotationtoolSite()
     from quotationtool.workflow.container import WorkFlowContainer
     self.assertTrue(isinstance(site['workflow'], WorkFlowContainer))
     from quotationtool.workflow.worklist import WorkList
     self.assertTrue(isinstance(site['workflow']['contributor'], WorkList))
     self.assertTrue(isinstance(site['workflow']['editor'], WorkList))
     self.assertTrue(
         isinstance(site['workflow']['technicaleditor'], WorkList))
     self.assertTrue(isinstance(site['workflow']['script'], WorkList))
コード例 #5
0
    def test_BibliographyCreation(self):
        from quotationtool.site.site import QuotationtoolSite
        from quotationtool.bibliography.interfaces import IBibliography
        from quotationtool.bibliography.bibliography import Bibliography
        self.root_folder['quotationtool'] = site = QuotationtoolSite()

        self.assertTrue(isinstance(site['bibliography'], Bibliography))
        ut = zope.component.queryUtility(IBibliography,
                                         context=site,
                                         default=None)
        self.assertTrue(ut == site['bibliography'])
コード例 #6
0
 def test_ExampleContainer(self):
     """ Test if container is created on a new site event."""
     from quotationtool.site.site import QuotationtoolSite
     from zope.container.btree import BTreeContainer
     root = BTreeContainer()
     root['quotationtool'] = site = QuotationtoolSite()
     self.assertTrue('examples' in site.keys())
     from quotationtool.figuresng.examplecontainer import ExampleContainer
     self.assertTrue(isinstance(site['examples'], ExampleContainer))
     from quotationtool.figuresng.iexample import IExampleContainer
     ut = zope.component.getUtility(IExampleContainer, context=site)
     self.assertTrue(ut is site['examples'])
コード例 #7
0
 def test_ExampleContainer(self):
     """ Test if container is created on a new site event."""
     from quotationtool.site.site import QuotationtoolSite
     from zope.container.btree import BTreeContainer
     root = BTreeContainer()
     root['quotationtool'] = site = QuotationtoolSite()
     self.assertTrue('comments' in site.keys())
     from quotationtool.commentary.commentcontainer import CommentContainer
     self.assertTrue(isinstance(site['comments'], CommentContainer))
     from quotationtool.commentary.interfaces import ICommentContainer
     ut = zope.component.getUtility(ICommentContainer, context=site)
     self.assertTrue(ut is site['comments'])
コード例 #8
0
 def test_IndexCreation(self):
     from quotationtool.site.site import QuotationtoolSite
     self.root_folder['quotationtool'] = site = QuotationtoolSite()
     from z3c.indexer.interfaces import IIndex
     for name in ('author-field', 'author-fulltext', 'title-field',
                  'title-fulltext', 'year-set', 'origyear-set',
                  'any-fulltext'):
         idx = zope.component.queryUtility(IIndex,
                                           name=name,
                                           context=site,
                                           default=None)
         self.assertTrue(idx is not None)
コード例 #9
0
def generateSite(root):
    from quotationtool.site.site import QuotationtoolSite
    root['quotationtool'] = site = QuotationtoolSite()
    return site