Changeset 5676 for main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests
- Timestamp:
- 25 Jan 2011, 13:21:00 (14 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/applicants
- Files:
-
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_container.py
r5647 r5676 21 21 ## 22 22 """ 23 Tests for applica tioncontainers.23 Tests for applicants containers. 24 24 """ 25 25 import unittest 26 26 from zope.interface.verify import verifyClass, verifyObject 27 from waeup.sirp.applica tions import interfaces28 from waeup.sirp.applica tions.container import ApplicationContainer27 from waeup.sirp.applicants import interfaces 28 from waeup.sirp.applicants.container import ApplicantsContainer 29 29 30 class Applica tionContainerTestCase(unittest.TestCase):30 class ApplicantsContainerTestCase(unittest.TestCase): 31 31 32 32 def test_interfaces(self): … … 34 34 self.assertTrue( 35 35 verifyClass( 36 interfaces.IApplica tionContainer, ApplicationContainer)36 interfaces.IApplicantsContainer, ApplicantsContainer) 37 37 ) 38 38 self.assertTrue( 39 39 verifyObject( 40 interfaces.IApplica tionContainer, ApplicationContainer())40 interfaces.IApplicantsContainer, ApplicantsContainer()) 41 41 ) 42 42 return … … 46 46 suite.addTests( 47 47 unittest.TestLoader().loadTestsFromTestCase( 48 Applica tionContainerTestCase,48 ApplicantsContainerTestCase, 49 49 ) 50 50 ) -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_root.py
r5659 r5676 21 21 ## 22 22 """ 23 Test applica tions root.23 Test applicants root. 24 24 """ 25 25 import logging … … 27 27 from StringIO import StringIO 28 28 from zope.interface.verify import verifyClass, verifyObject 29 from waeup.sirp.applica tions import interfaces30 from waeup.sirp.applica tions.root import (31 Applica tionsRoot, ApplicationsPlugin,29 from waeup.sirp.applicants import interfaces 30 from waeup.sirp.applicants.root import ( 31 ApplicantsRoot, ApplicantsPlugin, 32 32 ) 33 33 … … 35 35 pass 36 36 37 class Applica tionsRootTestCase(unittest.TestCase):37 class ApplicantsRootTestCase(unittest.TestCase): 38 38 39 39 def test_interfaces(self): … … 41 41 self.assertTrue( 42 42 verifyClass( 43 interfaces.IApplica tionsRoot, ApplicationsRoot)43 interfaces.IApplicantsRoot, ApplicantsRoot) 44 44 ) 45 45 self.assertTrue( 46 46 verifyObject( 47 interfaces.IApplica tionsRoot, ApplicationsRoot())47 interfaces.IApplicantsRoot, ApplicantsRoot()) 48 48 ) 49 49 return 50 50 51 class Applica tionsRootPluginTestCase(unittest.TestCase):51 class ApplicantsRootPluginTestCase(unittest.TestCase): 52 52 def create_logger(self): 53 53 # create a logger suitable for local tests. 54 test_logger = logging.getLogger('waeup.sirp.applica tions.testlogger')54 test_logger = logging.getLogger('waeup.sirp.applicants.testlogger') 55 55 log = StringIO() 56 56 handler = logging.StreamHandler(log) … … 83 83 # Real tests start here... 84 84 def test_pluginsetup(self): 85 # Make sure we can add Applica tionsRoot to sites.85 # Make sure we can add ApplicantsRoot to sites. 86 86 site = FakeSite() 87 plugin = Applica tionsPlugin()87 plugin = ApplicantsPlugin() 88 88 plugin.setup(site, 'blah', self.logger) 89 self.assertTrue('applica tions' in site.keys())89 self.assertTrue('applicants' in site.keys()) 90 90 log = self.get_log() 91 self.assertTrue('Installed applica tions root.' in log)91 self.assertTrue('Installed applicants root.' in log) 92 92 return 93 93 94 94 def test_update_new(self): 95 # Run update on a site without applica tions root.95 # Run update on a site without applicants root. 96 96 site = FakeSite() 97 plugin = Applica tionsPlugin()97 plugin = ApplicantsPlugin() 98 98 plugin.update(site, 'blah', self.logger) 99 self.assertTrue('applica tions' in site.keys())99 self.assertTrue('applicants' in site.keys()) 100 100 log = self.get_log() 101 101 self.assertTrue('Updating site at Unnamed Site' in log) 102 self.assertTrue('Installed applica tions root.' in log)102 self.assertTrue('Installed applicants root.' in log) 103 103 return 104 104 105 105 def test_update_outdated(self): 106 # Run update on a site with outdated applica tions root.106 # Run update on a site with outdated applicants root. 107 107 site = FakeSite() 108 root = object() # # This is not a proper applica tions root109 site['applica tions'] = root110 plugin = Applica tionsPlugin()108 root = object() # # This is not a proper applicants root 109 site['applicants'] = root 110 plugin = ApplicantsPlugin() 111 111 plugin.update(site, 'blah', self.logger) 112 self.assertTrue(site['applica tions'] is not root)113 self.assertTrue(isinstance(site['applica tions'], ApplicationsRoot))112 self.assertTrue(site['applicants'] is not root) 113 self.assertTrue(isinstance(site['applicants'], ApplicantsRoot)) 114 114 log = self.get_log() 115 self.assertTrue('Outdated applica tions folder detected' in log)115 self.assertTrue('Outdated applicants folder detected' in log) 116 116 self.assertTrue('Updating site at Unnamed Site' in log) 117 self.assertTrue('Installed applica tions root.' in log)117 self.assertTrue('Installed applicants root.' in log) 118 118 return 119 119 120 120 def test_update_uptodate(self): 121 # Run update on a site with proper applica tions root.121 # Run update on a site with proper applicants root. 122 122 site = FakeSite() 123 root = Applica tionsRoot()124 site['applica tions'] = root125 plugin = Applica tionsPlugin()123 root = ApplicantsRoot() 124 site['applicants'] = root 125 plugin = ApplicantsPlugin() 126 126 plugin.update(site, 'blah', self.logger) 127 self.assertTrue(site['applica tions'] is root)127 self.assertTrue(site['applicants'] is root) 128 128 log = self.get_log() 129 129 self.assertTrue('Updating site at Unnamed Site' in log) … … 135 135 site = FakeSite() 136 136 site.__name__ = 'my_site' 137 plugin = Applica tionsPlugin()137 plugin = ApplicantsPlugin() 138 138 plugin.update(site, 'blah', self.logger) 139 139 log = self.get_log() … … 144 144 suite = unittest.TestSuite() 145 145 for testcase in [ 146 Applica tionsRootTestCase,147 Applica tionsRootPluginTestCase,146 ApplicantsRootTestCase, 147 ApplicantsRootPluginTestCase, 148 148 ]: 149 149 suite.addTests(unittest.TestLoader().loadTestsFromTestCase(testcase))
Note: See TracChangeset for help on using the changeset viewer.