コード例 #1
0
    def testParentParentMissingFolder(self):
        encoll = self._create(self.en21, 'Topic', 'encoll', 'nocoll', 'svcoll')
        crit = encoll.addCriterion('path', 'ATRelativePathCriterion')
        crit.setRelativePath('../../en21')

        path = '/'.join(self.en21.getPhysicalPath())
        query = encoll.buildQuery()
        self.assertEquals(query['path']['query'], path)

        # Check the criterion has been copied over
        sync_collections(encoll)
        path = '/'.join(self.en21.getTranslation('no').getPhysicalPath())
        query = encoll.getTranslation('no').buildQuery()
        self.assertEquals(query['path']['query'], path)

        # See if changes to the criterion are copied
        crit.setRelativePath('../../en22')
        sync_collections(encoll)
        # There's no full Norwegian translation chain
        path = '/'.join(self.en2.getTranslation('no').getPhysicalPath())
        query = encoll.getTranslation('no').buildQuery()
        self.assertEquals(query['path']['query'], path + '/en22')
        nocoll_criteria = encoll.getTranslation('no').listCriteria()
        self.assertEquals(nocoll_criteria[0].getRelativePath(), '../../en22')

        query = encoll.getTranslation('sv').buildQuery()
        # There's no Swedish translation at all
        path = '/'.join(self.en22.getPhysicalPath())
        self.assertEquals(query['path']['query'], path)
        svcoll_criteria = encoll.getTranslation('sv').listCriteria()
        self.assertEquals(svcoll_criteria[0].getRelativePath(), '../../en22')
コード例 #2
0
    def testParentParentFolder(self):
        encoll = self._create(self.en1, 'Topic', 'encoll', 'nocoll', 'svcoll')
        crit = encoll.addCriterion('path', 'ATRelativePathCriterion')
        crit.setRelativePath('../../en2')

        path = '/'.join(self.en2.getPhysicalPath())
        query = encoll.buildQuery()
        self.assertEquals(query['path']['query'], path)

        # Check the criterion has been copied over
        sync_collections(encoll)
        path = '/'.join(self.en2.getTranslation('no').getPhysicalPath())
        query = encoll.getTranslation('no').buildQuery()
        self.assertEquals(query['path']['query'], path)

        # See if changes to the criterion are copied
        crit.setRelativePath('../../en1')
        sync_collections(encoll)
        path = '/'.join(self.en1.getTranslation('no').getPhysicalPath())
        query = encoll.getTranslation('no').buildQuery()
        self.assertEquals(query['path']['query'], path)

        path = '/'.join(self.en1.getTranslation('sv').getPhysicalPath())
        query = encoll.getTranslation('sv').buildQuery()
        self.assertEquals(query['path']['query'], path)
コード例 #3
0
    def testPathCriterion(self):
        crit = self.encoll.addCriterion('path', 'ATPathCriterion')
        endoc = self.en.doc1
        enpath = '/'.join(endoc.getPhysicalPath())
        crit.setValue((endoc.UID(), ))
        crit.setRecurse(True)
        query = self.encoll.buildQuery()
        self.assertEquals(query['path']['query'], [enpath])
        self.assertEquals(query['path']['depth'], -1)

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        nodoc = endoc.getTranslation('no')
        nopath = '/'.join(nodoc.getPhysicalPath())
        query = self.nocoll.buildQuery()
        self.assertEquals(query['path']['query'], [nopath])
        self.assertEquals(query['path']['depth'], -1)

        # See if changes to the criterion are copied
        endoc2 = self.en.doc2
        crit.setValue((endoc.UID(), endoc2.UID()))
        crit.setRecurse(False)

        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        nodoc2 = endoc2.getTranslation('no')
        nopath2 = '/'.join(nodoc2.getPhysicalPath())
        self.assertEquals(sorted(query['path']['query']),
            sorted([nopath, nopath2]))
        self.assertEquals(query['path']['depth'], 1)
コード例 #4
0
    def testParentParentMissingFolder(self):
        encoll = self._create(self.en21, 'Topic', 'encoll', 'nocoll', 'svcoll')
        crit = encoll.addCriterion('path', 'ATRelativePathCriterion')
        crit.setRelativePath('../../en21')

        path = '/'.join(self.en21.getPhysicalPath())
        query = encoll.buildQuery()
        self.assertEquals(query['path']['query'], path)

        # Check the criterion has been copied over
        sync_collections(encoll)
        path = '/'.join(self.en21.getTranslation('no').getPhysicalPath())
        query = encoll.getTranslation('no').buildQuery()
        self.assertEquals(query['path']['query'], path)

        # See if changes to the criterion are copied
        crit.setRelativePath('../../en22')
        sync_collections(encoll)
        # There's no full Norwegian translation chain
        path = '/'.join(self.en2.getTranslation('no').getPhysicalPath())
        query = encoll.getTranslation('no').buildQuery()
        self.assertEquals(query['path']['query'], path + '/en22')
        nocoll_criteria = encoll.getTranslation('no').listCriteria()
        self.assertEquals(nocoll_criteria[0].getRelativePath(), '../../en22')

        query = encoll.getTranslation('sv').buildQuery()
        # There's no Swedish translation at all
        path = '/'.join(self.en22.getPhysicalPath())
        self.assertEquals(query['path']['query'], path)
        svcoll_criteria = encoll.getTranslation('sv').listCriteria()
        self.assertEquals(svcoll_criteria[0].getRelativePath(), '../../en22')
コード例 #5
0
    def testPathCriterion(self):
        crit = self.encoll.addCriterion('path', 'ATPathCriterion')
        endoc = self.en.doc1
        enpath = '/'.join(endoc.getPhysicalPath())
        crit.setValue((endoc.UID(), ))
        crit.setRecurse(True)
        query = self.encoll.buildQuery()
        self.assertEquals(query['path']['query'], [enpath])
        self.assertEquals(query['path']['depth'], -1)

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        nodoc = endoc.getTranslation('no')
        nopath = '/'.join(nodoc.getPhysicalPath())
        query = self.nocoll.buildQuery()
        self.assertEquals(query['path']['query'], [nopath])
        self.assertEquals(query['path']['depth'], -1)

        # See if changes to the criterion are copied
        endoc2 = self.en.doc2
        crit.setValue((endoc.UID(), endoc2.UID()))
        crit.setRecurse(False)

        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        nodoc2 = endoc2.getTranslation('no')
        nopath2 = '/'.join(nodoc2.getPhysicalPath())
        self.assertEquals(sorted(query['path']['query']),
                          sorted([nopath, nopath2]))
        self.assertEquals(query['path']['depth'], 1)
コード例 #6
0
    def testParentParentFolder(self):
        encoll = self._create(self.en1, 'Topic', 'encoll', 'nocoll', 'svcoll')
        crit = encoll.addCriterion('path', 'ATRelativePathCriterion')
        crit.setRelativePath('../../en2')

        path = '/'.join(self.en2.getPhysicalPath())
        query = encoll.buildQuery()
        self.assertEquals(query['path']['query'], path)

        # Check the criterion has been copied over
        sync_collections(encoll)
        path = '/'.join(self.en2.getTranslation('no').getPhysicalPath())
        query = encoll.getTranslation('no').buildQuery()
        self.assertEquals(query['path']['query'], path)

        # See if changes to the criterion are copied
        crit.setRelativePath('../../en1')
        sync_collections(encoll)
        path = '/'.join(self.en1.getTranslation('no').getPhysicalPath())
        query = encoll.getTranslation('no').buildQuery()
        self.assertEquals(query['path']['query'], path)

        path = '/'.join(self.en1.getTranslation('sv').getPhysicalPath())
        query = encoll.getTranslation('sv').buildQuery()
        self.assertEquals(query['path']['query'], path)
コード例 #7
0
    def testCurrentAuthorCriterion(self):
        self.encoll.addCriterion('author', 'ATCurrentAuthorCriterion')
        query = self.encoll.buildQuery()
        self.assertEquals(query, {'author': 'portal_owner'})

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query, {'author': 'portal_owner'})
コード例 #8
0
    def testCurrentAuthorCriterion(self):
        self.encoll.addCriterion('author', 'ATCurrentAuthorCriterion')
        query = self.encoll.buildQuery()
        self.assertEquals(query, {'author': 'portal_owner'})

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query, {'author': 'portal_owner'})
コード例 #9
0
    def testSortCriterion(self):
        crit = self.encoll.addCriterion('sort', 'ATSortCriterion')
        crit.setReversed(True)

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        nocrit = self.nocoll.get(crit.getId())
        self.assertEquals(nocrit.getReversed(), True)

        # See if changes to the criterion are copied
        crit.setReversed(False)
        sync_collections(self.encoll)
        self.assertEquals(nocrit.getReversed(), False)
コード例 #10
0
    def testSortCriterion(self):
        crit = self.encoll.addCriterion('sort', 'ATSortCriterion')
        crit.setReversed(True)

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        nocrit = self.nocoll.get(crit.getId())
        self.assertEquals(nocrit.getReversed(), True)

        # See if changes to the criterion are copied
        crit.setReversed(False)
        sync_collections(self.encoll)
        self.assertEquals(nocrit.getReversed(), False)
コード例 #11
0
    def testRemoveCriteria(self):
        crit = self.encoll.addCriterion('portal_type', 'ATPortalTypeCriterion')
        crit.setValue(['Document'])
        crit = self.encoll.addCriterion('boolean', 'ATBooleanCriterion')
        crit.setBool(True)
        self.assertEquals(len(self.encoll.listCriteria()), 2)
        sync_collections(self.encoll)
        self.assertEquals(len(self.nocoll.listCriteria()), 2)

        # Remove a criteria
        one_id = self.encoll.listCriteria()[0].getId()
        self.encoll.deleteCriterion(one_id)
        self.assertEquals(len(self.encoll.listCriteria()), 1)
        sync_collections(self.encoll)
        self.assertEquals(len(self.nocoll.listCriteria()), 1)
コード例 #12
0
    def testRemoveCriteria(self):
        crit = self.encoll.addCriterion('portal_type', 'ATPortalTypeCriterion')
        crit.setValue(['Document'])
        crit = self.encoll.addCriterion('boolean', 'ATBooleanCriterion')
        crit.setBool(True)
        self.assertEquals(len(self.encoll.listCriteria()), 2)
        sync_collections(self.encoll)
        self.assertEquals(len(self.nocoll.listCriteria()), 2)

        # Remove a criteria
        one_id = self.encoll.listCriteria()[0].getId()
        self.encoll.deleteCriterion(one_id)
        self.assertEquals(len(self.encoll.listCriteria()), 1)
        sync_collections(self.encoll)
        self.assertEquals(len(self.nocoll.listCriteria()), 1)
コード例 #13
0
    def testPortalTypeCriterion(self):
        crit = self.encoll.addCriterion('portal_type', 'ATPortalTypeCriterion')
        crit.setValue(['Document', 'News Item'])
        query = self.encoll.buildQuery()
        self.assertEquals(query, {'portal_type': ('Document', 'News Item')})

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query, {'portal_type': ('Document', 'News Item')})

        # See if changes to the criterion are copied
        crit.setValue(['Document', 'Image'])
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query, {'portal_type': ('Document', 'Image')})
コード例 #14
0
    def testSimpleStringCriterion(self):
        crit = self.encoll.addCriterion('string', 'ATSimpleStringCriterion')
        crit.setValue('foo')

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        nocrit = self.nocoll.get(crit.getId())
        self.assertEquals(nocrit.Value(), 'foo')

        # Change the value in the translation
        nocrit.setValue('bar')

        # Make sure the changes aren't clobbered
        crit.setValue('baz')
        sync_collections(self.encoll)
        self.assertEquals(nocrit.Value(), 'bar')
コード例 #15
0
    def testAddCriteria(self):
        crit = self.encoll.addCriterion('portal_type', 'ATPortalTypeCriterion')
        crit.setValue(['Document'])
        self.assertEquals(len(self.encoll.listCriteria()), 1)

        # Check the criteria have been copied over
        sync_collections(self.encoll)
        self.assertEquals(len(self.nocoll.listCriteria()), 1)

        # Add a new criteria
        crit = self.encoll.addCriterion('boolean', 'ATBooleanCriterion')
        crit.setBool(True)
        self.assertEquals(len(self.encoll.listCriteria()), 2)

        sync_collections(self.encoll)
        self.assertEquals(len(self.nocoll.listCriteria()), 2)
コード例 #16
0
    def testAddCriteria(self):
        crit = self.encoll.addCriterion('portal_type', 'ATPortalTypeCriterion')
        crit.setValue(['Document'])
        self.assertEquals(len(self.encoll.listCriteria()), 1)

        # Check the criteria have been copied over
        sync_collections(self.encoll)
        self.assertEquals(len(self.nocoll.listCriteria()), 1)

        # Add a new criteria
        crit = self.encoll.addCriterion('boolean', 'ATBooleanCriterion')
        crit.setBool(True)
        self.assertEquals(len(self.encoll.listCriteria()), 2)

        sync_collections(self.encoll)
        self.assertEquals(len(self.nocoll.listCriteria()), 2)
コード例 #17
0
    def testSimpleStringCriterion(self):
        crit = self.encoll.addCriterion('string', 'ATSimpleStringCriterion')
        crit.setValue('foo')

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        nocrit = self.nocoll.get(crit.getId())
        self.assertEquals(nocrit.Value(), 'foo')

        # Change the value in the translation
        nocrit.setValue('bar')

        # Make sure the changes aren't clobbered
        crit.setValue('baz')
        sync_collections(self.encoll)
        self.assertEquals(nocrit.Value(), 'bar')
コード例 #18
0
    def testPortalTypeCriterion(self):
        crit = self.encoll.addCriterion(
            'portal_type', 'ATPortalTypeCriterion')
        crit.setValue(['Document', 'News Item'])
        query = self.encoll.buildQuery()
        self.assertEquals(query, {'portal_type': ('Document', 'News Item')})

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query, {'portal_type': ('Document', 'News Item')})

        # See if changes to the criterion are copied
        crit.setValue(['Document', 'Image'])
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query, {'portal_type': ('Document', 'Image')})
コード例 #19
0
    def testSelectionCriterion(self):
        crit = self.encoll.addCriterion('select', 'ATSelectionCriterion')
        crit.setValue(('tag1', 'tag2'))
        crit.setOperator('and')

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        nocrit = self.nocoll.get(crit.getId())
        self.assertEquals(nocrit.Value(), ('tag1', 'tag2'))
        self.assertEquals(nocrit.getOperator(), 'and')

        # See if changes to the criterion are copied
        crit.setValue(('tag3', 'tag2'))
        crit.setOperator('or')
        sync_collections(self.encoll)
        self.assertEquals(nocrit.Value(), ('tag3', 'tag2'))
        self.assertEquals(nocrit.getOperator(), 'or')
コード例 #20
0
    def testBooleanCriterion(self):
        crit = self.encoll.addCriterion('boolean', 'ATBooleanCriterion')
        crit.setBool(True)
        query = self.encoll.buildQuery()
        self.assertEquals(query, {'boolean': [1, True, '1', 'True']})

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query, {'boolean': [1, True, '1', 'True']})

        # See if changes to the criterion are copied
        crit.setBool(False)
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query,
            {'boolean': [0, '', False, '0', 'False', None, (), [], {}, MV]})
コード例 #21
0
    def testFieldSpecificSyncer(self):
        crit = self.encoll.addCriterion(
            'review_state', 'ATSimpleStringCriterion')
        crit.setValue('published')
        query = self.encoll.buildQuery()
        self.assertEquals(query, {'review_state': 'published'})

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query, {'review_state': 'published'})

        # See if changes to the criterion are copied
        crit.setValue('private')
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query, {'review_state': 'private'})
コード例 #22
0
    def testFieldSpecificSyncer(self):
        crit = self.encoll.addCriterion('review_state',
                                        'ATSimpleStringCriterion')
        crit.setValue('published')
        query = self.encoll.buildQuery()
        self.assertEquals(query, {'review_state': 'published'})

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query, {'review_state': 'published'})

        # See if changes to the criterion are copied
        crit.setValue('private')
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query, {'review_state': 'private'})
コード例 #23
0
    def testSelectionCriterion(self):
        crit = self.encoll.addCriterion('select', 'ATSelectionCriterion')
        crit.setValue(('tag1', 'tag2'))
        crit.setOperator('and')

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        nocrit = self.nocoll.get(crit.getId())
        self.assertEquals(nocrit.Value(), ('tag1', 'tag2'))
        self.assertEquals(nocrit.getOperator(), 'and')

        # See if changes to the criterion are copied
        crit.setValue(('tag3', 'tag2'))
        crit.setOperator('or')
        sync_collections(self.encoll)
        self.assertEquals(nocrit.Value(), ('tag3', 'tag2'))
        self.assertEquals(nocrit.getOperator(), 'or')
コード例 #24
0
ファイル: tests.py プロジェクト: witsch/Products.LinguaPlone
    def testBooleanCriterion(self):
        crit = self.encoll.addCriterion('boolean', 'ATBooleanCriterion')
        crit.setBool(True)
        query = self.encoll.buildQuery()
        self.assertEquals(query, {'boolean': [1, True, '1', 'True']})

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query, {'boolean': [1, True, '1', 'True']})

        # See if changes to the criterion are copied
        crit.setBool(False)
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query,
            {'boolean': [0, '', False, '0', 'False', None, (), [], {}, MV]})
コード例 #25
0
    def testCurrentFolder(self):
        crit = self.encoll.addCriterion('path', 'ATRelativePathCriterion')
        crit.setRelativePath('.')
        encollpath = '/'.join(self.encoll.getPhysicalPath())
        query = self.encoll.buildQuery()
        self.assertEquals(query['path']['query'], encollpath)

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        nocollpath = '/'.join(self.nocoll.getPhysicalPath())
        query = self.nocoll.buildQuery()
        self.assertEquals(query['path']['query'], nocollpath)

        # See if changes to the criterion are copied
        crit.setRecurse(False)
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query['path']['depth'], 1)
コード例 #26
0
    def testCurrentFolder(self):
        crit = self.encoll.addCriterion('path', 'ATRelativePathCriterion')
        crit.setRelativePath('.')
        encollpath = '/'.join(self.encoll.getPhysicalPath())
        query = self.encoll.buildQuery()
        self.assertEquals(query['path']['query'], encollpath)

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        nocollpath = '/'.join(self.nocoll.getPhysicalPath())
        query = self.nocoll.buildQuery()
        self.assertEquals(query['path']['query'], nocollpath)

        # See if changes to the criterion are copied
        crit.setRecurse(False)
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query['path']['depth'], 1)
コード例 #27
0
    def testDateRangeCriterion(self):
        crit = self.encoll.addCriterion('modified', 'ATDateRangeCriterion')
        start = DateTime('2010-02-14')
        end = DateTime('2010-02-25')
        crit.setStart(start)
        crit.setEnd(end)

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        nocrit = self.nocoll.get(crit.getId())
        self.assertEquals(crit.getStart(), start)
        self.assertEquals(crit.getEnd(), end)

        # See if changes to the criterion are copied
        crit.setStart(start + 1)
        crit.setEnd(end + 1)
        sync_collections(self.encoll)
        self.assertEquals(nocrit.getStart(), start + 1)
        self.assertEquals(nocrit.getEnd(), end + 1)
コード例 #28
0
    def testRootFolder(self):
        crit = self.encoll.addCriterion('path', 'ATRelativePathCriterion')
        crit.setRelativePath('/')

        portal_path = '/'.join(self.portal.getPhysicalPath()) + '/'
        query = self.encoll.buildQuery()
        self.assertEquals(query['path']['query'], portal_path)

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query['path']['query'], portal_path)

        # See if changes to the criterion are copied
        crit.setRelativePath('..')
        sync_collections(self.encoll)
        noparent_path = '/'.join(self.no.getPhysicalPath())
        query = self.nocoll.buildQuery()
        self.assertEquals(query['path']['query'], noparent_path)
コード例 #29
0
    def testDateRangeCriterion(self):
        crit = self.encoll.addCriterion('modified', 'ATDateRangeCriterion')
        start = DateTime('2010-02-14')
        end = DateTime('2010-02-25')
        crit.setStart(start)
        crit.setEnd(end)

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        nocrit = self.nocoll.get(crit.getId())
        self.assertEquals(crit.getStart(), start)
        self.assertEquals(crit.getEnd(), end)

        # See if changes to the criterion are copied
        crit.setStart(start + 1)
        crit.setEnd(end + 1)
        sync_collections(self.encoll)
        self.assertEquals(nocrit.getStart(), start + 1)
        self.assertEquals(nocrit.getEnd(), end + 1)
コード例 #30
0
    def testRootFolder(self):
        crit = self.encoll.addCriterion('path', 'ATRelativePathCriterion')
        crit.setRelativePath('/')

        portal_path = '/'.join(self.portal.getPhysicalPath()) + '/'
        query = self.encoll.buildQuery()
        self.assertEquals(query['path']['query'], portal_path)

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()
        self.assertEquals(query['path']['query'], portal_path)

        # See if changes to the criterion are copied
        crit.setRelativePath('..')
        sync_collections(self.encoll)
        noparent_path = '/'.join(self.no.getPhysicalPath())
        query = self.nocoll.buildQuery()
        self.assertEquals(query['path']['query'], noparent_path)
コード例 #31
0
    def testDateCriterion(self):
        crit = self.encoll.addCriterion('modified', 'ATFriendlyDateCriteria')
        crit.setValue(31)
        crit.setDateRange('+')
        crit.setOperation('less')

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        nocrit = self.nocoll.get(crit.getId())
        self.assertEquals(nocrit.Value(), crit.Value())
        self.assertEquals(nocrit.getDateRange(), crit.getDateRange())
        self.assertEquals(nocrit.getOperation(), crit.getOperation())

        # See if changes to the criterion are copied
        crit.setValue(14)
        crit.setOperation('more')
        sync_collections(self.encoll)
        self.assertEquals(nocrit.Value(), crit.Value())
        self.assertEquals(nocrit.getDateRange(), crit.getDateRange())
        self.assertEquals(nocrit.getOperation(), crit.getOperation())
コード例 #32
0
    def testDateCriterion(self):
        crit = self.encoll.addCriterion('modified', 'ATFriendlyDateCriteria')
        crit.setValue(31)
        crit.setDateRange('+')
        crit.setOperation('less')

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        nocrit = self.nocoll.get(crit.getId())
        self.assertEquals(nocrit.Value(), crit.Value())
        self.assertEquals(nocrit.getDateRange(), crit.getDateRange())
        self.assertEquals(nocrit.getOperation(), crit.getOperation())

        # See if changes to the criterion are copied
        crit.setValue(14)
        crit.setOperation('more')
        sync_collections(self.encoll)
        self.assertEquals(nocrit.Value(), crit.Value())
        self.assertEquals(nocrit.getDateRange(), crit.getDateRange())
        self.assertEquals(nocrit.getOperation(), crit.getOperation())
コード例 #33
0
    def testReferenceCriterion(self):
        crit = self.encoll.addCriterion(
            'getRawRelatedItems', 'ATReferenceCriterion')
        endoc = self.en.doc1
        crit.setValue(endoc.UID())
        query = self.encoll.buildQuery()['getRawRelatedItems']['query']
        self.assertEquals(query, (endoc.UID(), ))

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()['getRawRelatedItems']['query']
        nodoc = endoc.getTranslation('no')
        self.assertEquals(query, (nodoc.UID(), ))

        # See if changes to the criterion are copied
        endoc2 = self.en.doc2
        crit.setValue(endoc2.UID())
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()['getRawRelatedItems']['query']
        nodoc2 = endoc2.getTranslation('no')
        self.assertEquals(query, (nodoc2.UID(), ))
コード例 #34
0
    def testSimpleIntCriterion(self):
        crit = self.encoll.addCriterion('integer', 'ATSimpleIntCriterion')
        crit.setValue(1)
        crit.setValue2(2)
        crit.setDirection('min:max')

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        nocrit = self.nocoll.get(crit.getId())
        self.assertEquals(nocrit.Value(), 1)
        self.assertEquals(nocrit.Value2(), 2)
        self.assertEquals(nocrit.getDirection(), 'min:max')

        # See if changes to the criterion are copied
        crit.setValue(7)
        crit.setValue2(5)
        crit.setDirection('max')
        sync_collections(self.encoll)
        self.assertEquals(nocrit.Value(), 7)
        self.assertEquals(nocrit.Value2(), 5)
        self.assertEquals(nocrit.getDirection(), 'max')
コード例 #35
0
    def testSimpleIntCriterion(self):
        crit = self.encoll.addCriterion('integer', 'ATSimpleIntCriterion')
        crit.setValue(1)
        crit.setValue2(2)
        crit.setDirection('min:max')

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        nocrit = self.nocoll.get(crit.getId())
        self.assertEquals(nocrit.Value(), 1)
        self.assertEquals(nocrit.Value2(), 2)
        self.assertEquals(nocrit.getDirection(), 'min:max')

        # See if changes to the criterion are copied
        crit.setValue(7)
        crit.setValue2(5)
        crit.setDirection('max')
        sync_collections(self.encoll)
        self.assertEquals(nocrit.Value(), 7)
        self.assertEquals(nocrit.Value2(), 5)
        self.assertEquals(nocrit.getDirection(), 'max')
コード例 #36
0
    def testReferenceCriterion(self):
        crit = self.encoll.addCriterion('getRawRelatedItems',
                                        'ATReferenceCriterion')
        endoc = self.en.doc1
        crit.setValue(endoc.UID())
        query = self.encoll.buildQuery()['getRawRelatedItems']['query']
        self.assertEquals(query, (endoc.UID(), ))

        # Check the criterion has been copied over
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()['getRawRelatedItems']['query']
        nodoc = endoc.getTranslation('no')
        self.assertEquals(query, (nodoc.UID(), ))

        # See if changes to the criterion are copied
        endoc2 = self.en.doc2
        crit.setValue(endoc2.UID())
        sync_collections(self.encoll)
        query = self.nocoll.buildQuery()['getRawRelatedItems']['query']
        nodoc2 = endoc2.getTranslation('no')
        self.assertEquals(query, (nodoc2.UID(), ))
コード例 #37
0
    def testRootFolder(self):
        encoll = self._create(self.en1, 'Topic', 'encoll', 'nocoll', 'svcoll')
        crit = encoll.addCriterion('path', 'ATRelativePathCriterion')
        crit.setRelativePath('/')

        portal_path = '/'.join(self.portal.getPhysicalPath()) + '/'
        query = encoll.buildQuery()
        self.assertEquals(query['path']['query'], portal_path)

        # Check the criterion has been copied over
        sync_collections(encoll)
        query = encoll.getTranslation('no').buildQuery()
        self.assertEquals(query['path']['query'], portal_path)

        # See if changes to the criterion are copied
        crit.setRelativePath('/missing')
        sync_collections(encoll)
        query = encoll.getTranslation('no').buildQuery()
        self.assertEquals(query['path']['query'], portal_path + 'missing')

        query = encoll.getTranslation('sv').buildQuery()
        self.assertEquals(query['path']['query'], portal_path + 'missing')
コード例 #38
0
    def testRootFolder(self):
        encoll = self._create(self.en1, 'Topic', 'encoll', 'nocoll', 'svcoll')
        crit = encoll.addCriterion('path', 'ATRelativePathCriterion')
        crit.setRelativePath('/')

        portal_path = '/'.join(self.portal.getPhysicalPath()) + '/'
        query = encoll.buildQuery()
        self.assertEquals(query['path']['query'], portal_path)

        # Check the criterion has been copied over
        sync_collections(encoll)
        query = encoll.getTranslation('no').buildQuery()
        self.assertEquals(query['path']['query'], portal_path)

        # See if changes to the criterion are copied
        crit.setRelativePath('/missing')
        sync_collections(encoll)
        query = encoll.getTranslation('no').buildQuery()
        self.assertEquals(query['path']['query'], portal_path + 'missing')

        query = encoll.getTranslation('sv').buildQuery()
        self.assertEquals(query['path']['query'], portal_path + 'missing')
コード例 #39
0
 def testEmptyCollection(self):
     self.assert_('coll' in self.en)
     self.assert_(self.nocoll.getId() in self.no)
     sync_collections(self.encoll)
     self.assert_(self.nocoll.getId() in self.no)
コード例 #40
0
 def testEmptyCollection(self):
     self.assert_('coll' in self.en)
     self.assert_(self.nocoll.getId() in self.no)
     sync_collections(self.encoll)
     self.assert_(self.nocoll.getId() in self.no)