[Checkins] SVN: Products.GenericSetup/branches/1.4/Products/GenericSetup/tests/test_tool.py Added a test for handleProfileImportedEvent subscriber: After a full import it updates 'last version for profile'

Vincent Fretin vincent.fretin at gmail.com
Sun May 24 16:32:25 EDT 2009


Log message for revision 100348:
  Added a test for handleProfileImportedEvent subscriber: After a full import it updates 'last version for profile'

Changed:
  U   Products.GenericSetup/branches/1.4/Products/GenericSetup/tests/test_tool.py

-=-
Modified: Products.GenericSetup/branches/1.4/Products/GenericSetup/tests/test_tool.py
===================================================================
--- Products.GenericSetup/branches/1.4/Products/GenericSetup/tests/test_tool.py	2009-05-24 20:14:05 UTC (rev 100347)
+++ Products.GenericSetup/branches/1.4/Products/GenericSetup/tests/test_tool.py	2009-05-24 20:32:25 UTC (rev 100348)
@@ -538,7 +538,29 @@
                                                    ignore_dependencies=False)
         self.assertEqual(_imported, [self._PROFILE_PATH2, self._PROFILE_PATH])
 
+    def test_runAllImportStepsFromProfile_set_last_profile_version(self):
+        from Products.GenericSetup.metadata import METADATA_XML
 
+        self._makeFile(METADATA_XML, _METADATA_XML)
+
+        site = self._makeSite()
+        tool = self._makeOne('setup_tool').__of__( site )
+
+        profile_registry.registerProfile('foo', 'Foo', '', self._PROFILE_PATH)
+
+        # test initial states
+        profile_id = "other:foo"
+        self.assertEqual(tool.getVersionForProfile(profile_id), '1.0')
+        self.assertEqual(tool.getLastVersionForProfile(profile_id),
+                         'unknown')
+
+        # run all imports steps
+        result = tool.runAllImportStepsFromProfile('profile-other:foo', ignore_dependencies=True)
+
+        # events.handleProfileImportedEvent should set last profile version
+        self.assertEqual(tool.getLastVersionForProfile(profile_id),
+                         ('1', '0'))
+
     def test_runAllImportStepsFromProfileStepRegistrationWithDepends( self ):
         from Products.GenericSetup.metadata import METADATA_XML
 



More information about the Checkins mailing list