Ignore:
Timestamp:
Jan 26, 2010 3:00:48 PM (10 years ago)
Author:
mylan
Message:

Added tests of 'purge' option for portelts exporting section

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/portlets.txt

    r1588 r1589  
    103103</portlets> 
    104104<BLANKLINE> 
     105 
     106 
     107New portlet must be added to existent ones. 
    105108 
    106109>>> 'habra-rss' in mapping 
     
    124127>>> mapping['rss'].timeout 
    12512860 
     129 
     130 
     131Export sections has also ``purge`` option which specifies if portlets must 
     132be purged before exporting. The ``purge`` option set to ``False`` by default 
     133and not purge existent portlets. To force purging - it must be set to ``True``. 
     134 
     135>>> portlets2 = """ 
     136... [transmogrifier] 
     137... pipeline = 
     138...     portletssource 
     139...     portletsexporter 
     140...     printer 
     141...     dataprinter 
     142...     portletsimporter 
     143...      
     144... [portletssource] 
     145... blueprint = quintagroup.transmogrifier.tests.portletssource2 
     146...  
     147... [portletsexporter] 
     148... blueprint = quintagroup.transmogrifier.portletsexporter 
     149...  
     150... [printer] 
     151... blueprint = collective.transmogrifier.sections.tests.pprinter 
     152...  
     153... [dataprinter] 
     154... blueprint = quintagroup.transmogrifier.tests.dataprinter 
     155... print =  
     156...     _files 
     157...     portlets 
     158...     data 
     159...  
     160... [portletsimporter] 
     161... blueprint = quintagroup.transmogrifier.portletsimporter 
     162... files-key = files 
     163... purge = True 
     164... """ 
     165>>> registerConfig(u'quintagroup.transmogrifier.tests.portlets2', portlets2) 
     166>>> transmogrifier(u'quintagroup.transmogrifier.tests.portlets2') # doctest: +ELLIPSIS, +REPORT_NDIFF 
     167{} 
     168{'_files': {'portlets': {'data': ... 
     169                         'name': '.portlets.xml'}}, 
     170 '_path': 'other-assignable', 
     171 'files': {'portlets': {'data': ... 
     172                        'name': '.portlets.xml'}}} 
     173<?xml version="1.0" encoding="utf-8"?> 
     174<portlets> 
     175  <assignment category="context" key="/other-assignable" manager="plone.leftcolumn" name="rss" type="portlets.rss"> 
     176    <property name="count"> 
     177      10 
     178    </property> 
     179    <property name="url"> 
     180      http://sumno.com/feeds/main-page/ 
     181    </property> 
     182    <property name="portlet_title"> 
     183      RSS feed 
     184    </property> 
     185    <property name="timeout"> 
     186      60 
     187    </property> 
     188  </assignment> 
     189  <assignment category="context" key="/other-assignable" manager="plone.leftcolumn" name="habra-rss" type="portlets.rss"> 
     190    <property name="count"> 
     191      20 
     192    </property> 
     193    <property name="url"> 
     194      http://habrahabr.ru/rss/ 
     195    </property> 
     196    <property name="portlet_title"> 
     197      Habrahabr RSS feed 
     198    </property> 
     199    <property name="timeout"> 
     200      120 
     201    </property> 
     202  </assignment> 
     203  <blacklist category="user" manager="plone.leftcolumn" status="block"/> 
     204  <blacklist category="group" manager="plone.leftcolumn" status="acquire"/> 
     205  <blacklist category="content_type" manager="plone.leftcolumn" status="acquire"/> 
     206  <blacklist category="context" manager="plone.leftcolumn" status="acquire"/> 
     207</portlets> 
     208<BLANKLINE> 
     209 
     210Now only 'sumno-rss-2' portlet must be present in mapping after portlets purging. 
     211 
     212>>> 'habra-rss' in mapping 
     213False 
     214>>> 'rss' in mapping 
     215False 
     216>>> 'sumno-rss-2' in mapping 
     217True 
     218>>> mapping['sumno-rss-2'].count 
     21930 
     220>>> mapping['sumno-rss-2'].url 
     221u'http://sumno.com/rss' 
     222>>> mapping['sumno-rss-2'].portlet_title 
     223u'Sumno RSS feed' 
     224>>> mapping['sumno-rss-2'].timeout 
     225360 
     226 
Note: See TracChangeset for help on using the changeset viewer.