Ignore:
Timestamp:
Nov 18, 2010 3:42:34 PM (13 years ago)
Author:
fenix
Message:

fixed tests for plone.3.3.x

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.analytics/trunk/quintagroup/analytics/tests.py

    r3033 r3042  
    99 
    1010from Products.PloneTestCase import PloneTestCase as ptc 
     11from Products.PloneTestCase.version import PLONE33 
    1112from Products.PloneTestCase import setup as ptc_setup 
    1213from Products.PloneTestCase.layer import PloneSite 
     
    209210    def test_getChart(self): 
    210211        """ This test verifies creation of chart image tag.""" 
    211         chart_tag = """<img src="http://chart.apis.google.com/chart?chxt=y&amp; 
    212                        chds=0,57&amp;chd=t:19.0,18.0,17.0,16.0,15.0,14.0, 
    213                        13.0,12.0,11.0,10.0|19.0,18.0,17.0,16.0,15.0,14.0,13.0, 
    214                        12.0,11.0,10.0|19.0,18.0,17.0,16.0,15.0,14.0,13.0,12.0, 
    215                        11.0,10.0|0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0&amp; 
    216                        chxr=0,0,57&amp;chco=669933,cc9966,993300,ff6633,e8e4e3, 
    217                        a9a486,dcb57e,ffcc99,996633,333300,00ff00&amp;chl=user9| 
    218                        user8|user7|user6|user5|user4|user3|user2|user1|user0&amp; 
    219                        chbh=a,10,0&amp;chs=800x375&amp;cht=bvs&amp; 
    220                        chtt=Content+ownership+by+type&amp;chdl=Folder|Document| 
    221                        Event|Topic&amp;chdlp=b" />""" 
     212        plone33chart_tag = \ 
     213          """<imgsrc="http://chart.apis.google.com/chart?chxt=y&amp; 
     214             chds=0,57&amp;chd=t:19.0,18.0,17.0,16.0,15.0,14.0,13.0, 
     215             12.0,11.0,10.0|19.0,18.0,17.0,16.0,15.0,14.0,13.0,12.0, 
     216             11.0,10.0|19.0,18.0,17.0,16.0,15.0,14.0,13.0,12.0,11.0, 
     217             10.0|0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0|0.0,0.0, 
     218             0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0&amp;chxr=0,0,57&amp; 
     219             chco=669933,cc9966,993300,ff6633,e8e4e3,a9a486,dcb57e, 
     220             ffcc99,996633,333300,00ff00&amp;chl=user9|user8| 
     221             user7|user6|user5|user4|user3|user2|user1|user0&amp; 
     222             chbh=a,10,0&amp;chs=800x375&amp;cht=bvs&amp; 
     223             chtt=Content+ownership+by+type&amp;chdl=Folder| 
     224             Document|Event|Large+Plone+Folder|Topic&amp;chdlp=b"/>""" 
     225        plone4chart_tag = \ 
     226          """<img src="http://chart.apis.google.com/chart?chxt=y&amp; 
     227             chds=0,57&amp;chd=t:19.0,18.0,17.0,16.0,15.0,14.0, 
     228             13.0,12.0,11.0,10.0|19.0,18.0,17.0,16.0,15.0,14.0,13.0, 
     229             12.0,11.0,10.0|19.0,18.0,17.0,16.0,15.0,14.0,13.0,12.0, 
     230             11.0,10.0|0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0&amp; 
     231             chxr=0,0,57&amp;chco=669933,cc9966,993300,ff6633,e8e4e3, 
     232             a9a486,dcb57e,ffcc99,996633,333300,00ff00&amp;chl=user9| 
     233             user8|user7|user6|user5|user4|user3|user2|user1|user0&amp; 
     234             chbh=a,10,0&amp;chs=800x375&amp;cht=bvs&amp; 
     235             chtt=Content+ownership+by+type&amp;chdl=Folder|Document| 
     236             Event|Topic&amp;chdlp=b" />""" 
     237        chart_tag = PLONE33 and plone33chart_tag or plone4chart_tag 
     238 
    222239        self.loginAsPortalOwner() 
    223240        self.assertEqual(*map(lambda s:''.join(s.split()), 
     
    291308    def test_getTypes(self): 
    292309        """ Tests method that returns ordered list of types.""" 
    293         self.assert_(False not in map(lambda t1, t2:t1==t2, 
    294                                       ['Folder', 'Document', 'Event', 'Topic'], 
     310        index = self.pc._catalog.getIndex('portal_type') 
     311        data = {} 
     312        for k in index._index.keys(): 
     313            if not k: 
     314                continue 
     315            haslen = hasattr(index._index[k], '__len__') 
     316            if haslen: 
     317                data[k] = len(index._index[k]) 
     318            else: 
     319                data[k] = 1 
     320        data = data.items() 
     321        data.sort(lambda a, b: a[1] - b[1]) 
     322        data.reverse() 
     323        types = [i[0] for i in data] 
     324        self.assert_(False not in map(lambda t1, t2:t1==t2, types, 
    295325                                      self.view.getTypes())) 
    296326 
     
    318348    def test_getChart(self): 
    319349        """ This test verifies creation of chart image tag.""" 
    320         chart_tag = """ <imgsrc="http://chart.apis.google.com/chart?chxt=y&amp; 
    321                         chds=0,159&amp;chd=t:156.0,145.0,145.0,0.0|3.0,1.0,0.0, 
    322                         3.0|0.0,0.0,0.0,0.0&amp;chxr=0,0,159&amp;chco=669933, 
    323                         cc9966,993300,ff6633,e8e4e3,a9a486,dcb57e,ffcc99,996633, 
    324                         333300,00ff00&amp;chl=Folder|Document|Event|Topic&amp; 
    325                         chbh=a,10,0&amp;chs=800x375&amp;cht=bvs&amp; 
    326                         chtt=Content+type+by+state&amp;chdl=private|published| 
    327                         No+workflow&amp;chdlp=b"/>""" 
     350        plone33chart_tag = \ 
     351          """<imgsrc="http://chart.apis.google.com/chart?chxt=y&amp;chds=0, 
     352             156&amp;chd=t:156.0,145.0,145.0,0.0,0.0|0.0,1.0,0.0,3.0,3.0| 
     353             0.0,0.0,0.0,0.0,0.0&amp;chxr=0,0,156&amp;chco=669933,cc9966, 
     354             993300,ff6633,e8e4e3,a9a486,dcb57e,ffcc99,996633,333300, 
     355             00ff00&amp;chl=Folder|Document|Event|Large+Plone+Folder| 
     356             Topic&amp;chbh=a,10,0&amp;chs=800x375&amp;cht=bvs&amp; 
     357             chtt=Content+type+by+state&amp;chdl=private|published| 
     358             No+workflow&amp;chdlp=b"/>""" 
     359        plone4chart_tag = \ 
     360          """<img src="http://chart.apis.google.com/chart?chxt=y&amp; 
     361             chds=0,57&amp;chd=t:19.0,18.0,17.0,16.0,15.0,14.0, 
     362             13.0,12.0,11.0,10.0|19.0,18.0,17.0,16.0,15.0,14.0,13.0, 
     363             12.0,11.0,10.0|19.0,18.0,17.0,16.0,15.0,14.0,13.0,12.0, 
     364             11.0,10.0|0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0&amp; 
     365             chxr=0,0,57&amp;chco=669933,cc9966,993300,ff6633,e8e4e3, 
     366             a9a486,dcb57e,ffcc99,996633,333300,00ff00&amp;chl=user9| 
     367             user8|user7|user6|user5|user4|user3|user2|user1|user0&amp; 
     368             chbh=a,10,0&amp;chs=800x375&amp;cht=bvs&amp; 
     369             chtt=Content+ownership+by+type&amp;chdl=Folder|Document| 
     370             Event|Topic&amp;chdlp=b" />""" 
     371        chart_tag = PLONE33 and plone33chart_tag or plone4chart_tag 
    328372 
    329373        self.loginAsPortalOwner() 
Note: See TracChangeset for help on using the changeset viewer.