Changeset 1897 in products


Ignore:
Timestamp:
Mar 11, 2010 8:28:48 PM (10 years ago)
Author:
mylan
Message:

#161: Use test cases with Installed and NotInstalled? layers

Location:
quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer/tests/testInstallation.py

    r1877 r1897  
    77from zope.publisher.browser import TestRequest 
    88from zope.viewlet.interfaces import IViewletManager 
    9 from plone.browserlayer import utils 
     9 
    1010from quintagroup.seoptimizer.browser.interfaces import IPloneSEOLayer 
    1111 
     
    2828 
    2929 
    30 class TestBeforeInstallation(FunctionalTestCase): 
    31  
    32     def afterSetUp(self): 
    33         self.qi = self.portal.portal_quickinstaller 
    34         self.qi.uninstallProducts([PROJECT_NAME]) 
     30class TestBeforeInstallation(FunctionalTestCaseNotInstalled): 
     31 
     32    def afterSetUp(self): 
     33        #self.qi = self.portal.portal_quickinstaller 
     34        #self.qi.uninstallProducts([PROJECT_NAME]) 
    3535        self.basic_auth = 'mgr:mgrpw' 
    3636        self.portal_path = '/%s' % self.portal.absolute_url(1) 
     
    8787         
    8888    def test_browser_layer(self): 
     89        from plone.browserlayer import utils 
    8990        self.assert_(IPloneSEOLayer in utils.registered_layers(), 
    9091                     "Not registered 'IPloneSEOLayer' browser layer") 
     
    143144 
    144145    def test_browserlayer_uninstall(self): 
     146        from plone.browserlayer import utils 
    145147        self.assertEqual(IPloneSEOLayer in utils.registered_layers(), False, 
    146             "Not registered 'IPloneSEOLayer' browser layer") 
     148            "Still registered 'IPloneSEOLayer' browser layer") 
    147149 
    148150    def test_jsregestry_uninstall(self): 
  • quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer/tests/testMetaTagsDuplication.py

    r1893 r1897  
    77                         '(?:content=".*?"\s*)){2}/>)', re.S|re.M) 
    88 
    9 class TestMetaTagsDuplication(FunctionalTestCase): 
     9class InstallMixin: 
    1010 
    11     def afterSetUp(self): 
    12         self.qi = self.portal.portal_quickinstaller 
     11    def prepare(self): 
    1312        # Preparation for functional testing 
    1413        self.loginAsPortalOwner() 
     
    2221        self.html = self.publish(self.abs_path).getBody() 
    2322 
     23 
     24class TestTagsDuplicationInstalled(InstallMixin, FunctionalTestCase): 
     25 
     26    def afterSetUp(self): 
     27        self.prepare() 
     28 
    2429    def test_GeneratorMetaSEOInstalled(self): 
    2530        lengen = len(GENERATOR.findall(self.html)) 
     
    2732           "when seoptimizer installed" % lengen) 
    2833  
    29     def test_GeneratorMetaSEOUninstalled(self): 
    30         self.qi.uninstallProducts([PROJECT_NAME,]) 
    31         lengen = len(GENERATOR.findall(self.html)) 
    32         self.assert_(lengen<=1, "There is %d generator meta tag(s) " \ 
    33             "when seoptimizer uninstalled" % lengen) 
    34  
    3534    def test_DescriptionMetaSEOInstalled(self): 
    3635        lendesc = len(DESCRIPTION.findall(self.html)) 
     
    3837           "when seoptimizer installed" % lendesc) 
    3938 
     39 
     40class TestTagsDuplicationNotInstalled(InstallMixin, 
     41                                      FunctionalTestCaseNotInstalled): 
     42 
     43    def afterSetUp(self): 
     44        self.prepare() 
     45 
     46    def test_GeneratorMetaSEOUninstalled(self): 
     47        lengen = len(GENERATOR.findall(self.html)) 
     48        self.assert_(lengen<=1, "There is %d generator meta tag(s) " \ 
     49            "when seoptimizer uninstalled" % lengen) 
     50 
    4051    def test_DescriptionMetaSEOUninstalled(self): 
    41         self.qi.uninstallProducts([PROJECT_NAME,]) 
    4252        lendesc = len(DESCRIPTION.findall(self.html)) 
    4353        self.assert_(lendesc==1, "There is %d DESCRIPTION meta tag(s) " \ 
     
    4858    from unittest import TestSuite, makeSuite 
    4959    suite = TestSuite() 
    50     suite.addTest(makeSuite(TestMetaTagsDuplication)) 
     60    suite.addTest(makeSuite(TestTagsDuplicationInstalled)) 
     61    suite.addTest(makeSuite(TestTagsDuplicationNotInstalled)) 
    5162    return suite 
Note: See TracChangeset for help on using the changeset viewer.