Changeset 3003 in products


Ignore:
Timestamp:
Nov 11, 2010 7:24:30 PM (13 years ago)
Author:
fenix
Message:

added test to verify if configlet is installed properly

Location:
quintagroup.analytics/trunk/quintagroup/analytics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.analytics/trunk/quintagroup/analytics/configure.zcml

    r2893 r3003  
    55    i18n_domain="quintagroup.analytics"> 
    66 
    7     <!-- make plone site object traversable --> 
    8     <!--five:traversable 
    9         class="Products.CMFPlone.Portal.PloneSite" 
    10         /--> 
    11  
    12     <include package=".browser" /> 
     7  <include package=".browser" /> 
    138 
    149  <genericsetup:registerProfile 
  • quintagroup.analytics/trunk/quintagroup/analytics/tests.py

    r2870 r3003  
    11import unittest 
     2import transaction 
    23 
    3 from zope.testing import doctestunit 
    44from zope.component import testing 
    55from Testing import ZopeTestCase as ztc 
     
    88from Products.Five import fiveconfigure 
    99from Products.PloneTestCase import PloneTestCase as ptc 
     10from Products.PloneTestCase import setup as ptc_setup 
    1011from Products.PloneTestCase.layer import PloneSite 
     12import quintagroup.analytics 
    1113ptc.setupPloneSite() 
    12  
    13 import quintagroup.contentstats 
    1414 
    1515class TestCase(ptc.PloneTestCase): 
     
    1919            fiveconfigure.debug_mode = True 
    2020            zcml.load_config('configure.zcml', 
    21                              quintagroup.contentstats) 
     21                             quintagroup.analytics) 
    2222            fiveconfigure.debug_mode = False 
     23            ztc.installPackage('quintagroup.analytics') 
     24            app = ztc.app() 
     25            portal = app[ptc_setup.portal_name] 
     26 
     27            # Sets the local site/manager 
     28            ptc_setup._placefulSetUp(portal) 
     29 
     30            qi = getattr(portal, 'portal_quickinstaller', None) 
     31            qi.installProduct('quintagroup.analytics') 
     32            transaction.commit() 
    2333 
    2434        @classmethod 
     
    2737 
    2838 
     39#TO DO:===================================================================== 
     40#      add test to verify if QA control panel action is present; 
     41#      add tests for views registration; 
     42#      add tests for every views methods; 
     43#      add doc tests to validate if all needed elements are present on page; 
     44 
     45 
     46 
     47class TestQAInstallation(TestCase): 
     48    """ This class veryfies registrations of all needed views and 
     49        actions. 
     50    """ 
     51 
     52    def test_cp_action_installation(self): 
     53        """Here we are testin control panel action. """ 
     54        control_panel = self.portal.portal_controlpanel 
     55        self.assert_('QAnalytics' in [a.id for a in control_panel.listActions()], 
     56                     "Configlet for quintagroup.analitycs isn't registered.") 
     57 
     58 
    2959def test_suite(): 
    30     return unittest.TestSuite([ 
     60    from unittest import TestSuite, makeSuite 
     61 
     62    test_suite = unittest.TestSuite([ 
    3163 
    3264        # Unit tests 
     
    5183        ]) 
    5284 
     85    test_suite.addTest(makeSuite(TestQAInstallation)) 
     86    return test_suite 
     87 
    5388if __name__ == '__main__': 
    5489    unittest.main(defaultTest='test_suite') 
Note: See TracChangeset for help on using the changeset viewer.