Changeset 3004 in products


Ignore:
Timestamp:
Nov 12, 2010 8:54:57 AM (11 years ago)
Author:
fenix
Message:

added tests for views registrations.

File:
1 edited

Legend:

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

    r3003 r3004  
    22import transaction 
    33 
    4 from zope.component import testing 
     4from zope.component import testing, queryMultiAdapter 
    55from Testing import ZopeTestCase as ztc 
    66 
     
    3838 
    3939#TO DO:===================================================================== 
    40 #      add test to verify if QA control panel action is present; 
    41 #      add tests for views registration; 
    4240#      add tests for every views methods; 
    4341#      add doc tests to validate if all needed elements are present on page; 
     
    5149 
    5250    def test_cp_action_installation(self): 
    53         """Here we are testin control panel action. """ 
     51        """This test validates control panel action. """ 
    5452        control_panel = self.portal.portal_controlpanel 
    5553        self.assert_('QAnalytics' in [a.id for a in control_panel.listActions()], 
    5654                     "Configlet for quintagroup.analitycs isn't registered.") 
    5755 
     56    def test_OwnershipByType(self): 
     57        """ This test validates registration of 
     58            ownership_by_type view. 
     59        """ 
     60        view = queryMultiAdapter((self.portal, self.portal.REQUEST), 
     61                                 name="ownership_by_type") 
     62 
     63        self.assert_(view, "Ownership by type view isn't registered") 
     64 
     65    def test_OwnershipByState(self): 
     66        """ This test validates registration of 
     67            ownership_by_state view. 
     68        """ 
     69        view = queryMultiAdapter((self.portal, self.portal.REQUEST), 
     70                                 name="ownership_by_state") 
     71 
     72        self.assert_(view, "Ownership by state view isn't registered") 
     73 
     74    def test_TypeByState(self): 
     75        """ This test validates registration of 
     76            type_by_state view. 
     77        """ 
     78        view = queryMultiAdapter((self.portal, self.portal.REQUEST), 
     79                                 name="type_by_state") 
     80 
     81        self.assert_(view, "Type by state view isn't registered") 
     82 
     83    def test_LegacyPortlets(self): 
     84        """ This test validates registration of 
     85            legacy_portlets view. 
     86        """ 
     87        view = queryMultiAdapter((self.portal, self.portal.REQUEST), 
     88                                 name="legacy_portlets") 
     89 
     90        self.assert_(view, "Legacy Portlets view isn't registered") 
     91 
     92    def test_PropertiesStats(self): 
     93        """ This test validates registration of 
     94            properties_stats view. 
     95        """ 
     96        view = queryMultiAdapter((self.portal, self.portal.REQUEST), 
     97                                 name="properties_stats") 
     98 
     99        self.assert_(view, "Properties Stats view isn't registered") 
     100 
     101 
     102    def test_PortletsStats(self): 
     103        """ This test validates registration of 
     104            portlets_stats view. 
     105        """ 
     106        view = queryMultiAdapter((self.portal, self.portal.REQUEST), 
     107                                 name="portlets_stats") 
     108 
     109        self.assert_(view, "Portlets Stats view isn't registered") 
    58110 
    59111def test_suite(): 
Note: See TracChangeset for help on using the changeset viewer.