[Checkins] SVN: Products.GenericSetup/trunk/Products/GenericSetup/tests/ - added some tests for current upgrade behavior

Yvo Schubbe y.2008 at wcm-solutions.de
Fri Dec 19 17:26:52 EST 2008


Log message for revision 94206:
  - added some tests for current upgrade behavior

Changed:
  A   Products.GenericSetup/trunk/Products/GenericSetup/tests/tests.py
  A   Products.GenericSetup/trunk/Products/GenericSetup/tests/upgrade.txt

-=-
Added: Products.GenericSetup/trunk/Products/GenericSetup/tests/tests.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/tests/tests.py	                        (rev 0)
+++ Products.GenericSetup/trunk/Products/GenericSetup/tests/tests.py	2008-12-19 22:26:52 UTC (rev 94206)
@@ -0,0 +1,27 @@
+##############################################################################
+#
+# Copyright (c) 2008 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""GenericSetup doc tests.
+
+$Id$
+"""
+
+import unittest
+from zope.testing import doctest
+
+def test_suite():
+    suite = unittest.TestSuite()
+    suite.addTest(doctest.DocFileSuite('upgrade.txt'))
+    return suite
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: Products.GenericSetup/trunk/Products/GenericSetup/tests/tests.py
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Added: Products.GenericSetup/trunk/Products/GenericSetup/tests/upgrade.txt
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/tests/upgrade.txt	                        (rev 0)
+++ Products.GenericSetup/trunk/Products/GenericSetup/tests/upgrade.txt	2008-12-19 22:26:52 UTC (rev 94206)
@@ -0,0 +1,433 @@
+UpgradeEntity
+-------------
+
+    >>> from Products.GenericSetup.upgrade import _extractStepInfo
+    >>> from Products.GenericSetup.upgrade import UpgradeEntity
+    >>> tool = object()
+    >>> def true_checker(tool): return True
+    >>> def false_checker(tool): return False
+
+    with no restrictions: all -> all, no checker
+    --------------------------------------------
+
+        >>> e = UpgradeEntity('TITLE', 'PROFILE', '*', '*', 'DESC')
+        >>> e.source is None
+        True
+        >>> e.dest is None
+        True
+
+        all <> unknown <> all
+
+            >>> e.versionMatch(None)
+            True
+            >>> e.isProposed(tool, None)
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, None))
+            True
+            >>> e.versionMatch('unknown')
+            True
+            >>> e.isProposed(tool, 'unknown')
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, 'unknown'))
+            True
+
+        all <> 1.0 <> all
+
+            >>> e.versionMatch('1.0')
+            True
+            >>> e.isProposed(tool, '1.0')
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, '1.0'))
+            True
+
+        all <> 2.0 <> all
+
+            >>> e.versionMatch('2.0')
+            True
+            >>> e.isProposed(tool, '2.0')
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, '2.0'))
+            True
+
+    with version restriction: 1.0 -> 2.0, no checker
+    ------------------------------------------------
+
+        >>> e = UpgradeEntity('TITLE', 'PROFILE', '1.0', '2.0', 'DESC')
+        >>> e.source
+        ('1', '0')
+        >>> e.dest
+        ('2', '0')
+
+        1.0 <> unknown <> 2.0
+
+            >>> e.versionMatch(None)
+            True
+            >>> e.isProposed(tool, None)
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, None))
+            True
+            >>> e.versionMatch('unknown') # XXX: True
+            False
+            >>> e.isProposed(tool, 'unknown') # XXX: True
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, 'unknown'))
+            True
+
+        1.0 == 1.0 < 2.0
+
+            >>> e.versionMatch('1.0') # XXX: True
+            False
+            >>> e.isProposed(tool, '1.0') # XXX: True
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, '1.0'))
+            True
+
+        1.0 < 2.0 == 2.0
+
+            >>> e.versionMatch('2.0')
+            False
+            >>> e.isProposed(tool, '2.0')
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, '2.0'))
+            False
+
+    with version restriction: 1.1 -> 2.0, no checker
+    ------------------------------------------------
+
+        >>> e = UpgradeEntity('TITLE', 'PROFILE', '1.1', '2.0', 'DESC')
+        >>> e.source
+        ('1', '1')
+        >>> e.dest
+        ('2', '0')
+
+        1.1 <> unknown <> 2.0
+
+            >>> e.versionMatch(None)
+            True
+            >>> e.isProposed(tool, None)
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, None))
+            True
+            >>> e.versionMatch('unknown') # XXX: True
+            False
+            >>> e.isProposed(tool, 'unknown') # XXX: True
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, 'unknown'))
+            True
+
+        1.1 > 1.0 < 2.0
+
+            >>> e.versionMatch('1.0')
+            False
+            >>> e.isProposed(tool, '1.0')
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, '1.0'))
+            True
+
+        1.1 < 2.0 == 2.0
+
+            >>> e.versionMatch('2.0')
+            False
+            >>> e.isProposed(tool, '2.0')
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, '2.0'))
+            False
+
+    with version restriction: 2.0 -> 3.0, no checker
+    ------------------------------------------------
+
+        >>> e = UpgradeEntity('TITLE', 'PROFILE', '2.0', '3.0', 'DESC')
+        >>> e.source
+        ('2', '0')
+        >>> e.dest
+        ('3', '0')
+
+        2.0 <> unknown <> 3.0
+
+            >>> e.versionMatch(None)
+            True
+            >>> e.isProposed(tool, None)
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, None))
+            True
+            >>> e.versionMatch('unknown') # XXX: True
+            False
+            >>> e.isProposed(tool, 'unknown') # XXX: True
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, 'unknown'))
+            True
+
+        2.0 > 1.0 < 3.0
+
+            >>> e.versionMatch('1.0')
+            False
+            >>> e.isProposed(tool, '1.0')
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, '1.0'))
+            True
+
+
+        2.0 == 2.0 < 3.0
+
+            >>> e.versionMatch('2.0') # XXX: True
+            False
+            >>> e.isProposed(tool, '2.0') # XXX: True
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, '2.0'))
+            True
+
+    with checker restriction: all -> all, true checker
+    --------------------------------------------------
+
+        >>> e = UpgradeEntity('TITLE', 'PROFILE', '*', '*', 'DESC', true_checker)
+
+        all <> unknown <> all
+
+            >>> e.versionMatch(None)
+            True
+            >>> e.isProposed(tool, None)
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, None))
+            True
+
+        all <> 1.0 <> all
+
+            >>> e.versionMatch('1.0')
+            True
+            >>> e.isProposed(tool, '1.0')
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, '1.0'))
+            True
+
+        all <> 2.0 <> all
+
+            >>> e.versionMatch('2.0')
+            True
+            >>> e.isProposed(tool, '2.0')
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, '2.0'))
+            True
+
+    with checker restriction: all -> all, false checker
+    ---------------------------------------------------
+
+        >>> e = UpgradeEntity('TITLE', 'PROFILE', '*', '*', 'DESC', false_checker)
+
+        all <> unknown <> all
+
+            >>> e.versionMatch(None)
+            True
+            >>> e.isProposed(tool, None)
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, None))
+            True
+
+        all <> 1.0 <> all
+
+            >>> e.versionMatch('1.0')
+            True
+            >>> e.isProposed(tool, '1.0')
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, '1.0')) # XXX: True
+            False
+
+        all <> 2.0 <> all
+
+            >>> e.versionMatch('2.0')
+            True
+            >>> e.isProposed(tool, '2.0')
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, '2.0')) # XXX: True
+            False
+
+    with combined restrictions: 1.0 -> 2.0, true checker
+    ----------------------------------------------------
+
+        >>> e = UpgradeEntity('TITLE', 'PROFILE', '1.0', '2.0', 'DESC', true_checker)
+
+        1.0 <> unknown <> 2.0
+
+            >>> e.versionMatch(None)
+            True
+            >>> e.isProposed(tool, None)
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, None))
+            True
+
+        1.0 == 1.0 < 2.0
+
+            >>> e.versionMatch('1.0') # XXX: True
+            False
+            >>> e.isProposed(tool, '1.0')
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, '1.0'))
+            True
+
+        1.0 < 2.0 == 2.0
+
+            >>> e.versionMatch('2.0')
+            False
+            >>> e.isProposed(tool, '2.0')
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, '2.0'))
+            True
+
+    with combined restrictions: 1.1 -> 2.0, true checker
+    ----------------------------------------------------
+
+        >>> e = UpgradeEntity('TITLE', 'PROFILE', '1.1', '2.0', 'DESC', true_checker)
+
+        1.1 <> unknown <> 2.0
+
+            >>> e.versionMatch(None)
+            True
+            >>> e.isProposed(tool, None)
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, None))
+            True
+
+        1.1 > 1.0 < 2.0
+
+            >>> e.versionMatch('1.0')
+            False
+            >>> e.isProposed(tool, '1.0')
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, '1.0'))
+            True
+
+        1.1 < 2.0 == 2.0
+
+            >>> e.versionMatch('2.0')
+            False
+            >>> e.isProposed(tool, '2.0')
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, '2.0'))
+            True
+
+    with combined restrictions: 2.0 -> 3.0, true checker
+    ----------------------------------------------------
+
+        >>> e = UpgradeEntity('TITLE', 'PROFILE', '2.0', '3.0', 'DESC', true_checker)
+
+        2.0 <> unknown <> 3.0
+
+            >>> e.versionMatch(None)
+            True
+            >>> e.isProposed(tool, None)
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, None))
+            True
+
+        2.0 > 1.0 < 3.0
+
+            >>> e.versionMatch('1.0')
+            False
+            >>> e.isProposed(tool, '1.0')
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, '1.0'))
+            True
+
+        2.0 == 2.0 < 3.0
+
+            >>> e.versionMatch('2.0') # XXX: True
+            False
+            >>> e.isProposed(tool, '2.0')
+            True
+            >>> bool(_extractStepInfo(tool, 'ID', e, '2.0'))
+            True
+
+    with combined restrictions: 1.0 -> 2.0, false checker
+    -----------------------------------------------------
+
+        >>> e = UpgradeEntity('TITLE', 'PROFILE', '1.0', '2.0', 'DESC', false_checker)
+
+        1.0 <> unknown <> 2.0
+
+            >>> e.versionMatch(None)
+            True
+            >>> e.isProposed(tool, None)
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, None))
+            True
+
+        1.0 == 1.0 < 2.0
+
+            >>> e.versionMatch('1.0') # XXX: True
+            False
+            >>> e.isProposed(tool, '1.0')
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, '1.0'))
+            True
+
+        1.0 < 2.0 == 2.0
+
+            >>> e.versionMatch('2.0')
+            False
+            >>> e.isProposed(tool, '2.0')
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, '2.0'))
+            False
+
+    with combined restrictions: 1.1 -> 2.0, false checker
+    -----------------------------------------------------
+
+        >>> e = UpgradeEntity('TITLE', 'PROFILE', '1.1', '2.0', 'DESC', false_checker)
+
+        1.1 <> unknown <> 2.0
+
+            >>> e.versionMatch(None)
+            True
+            >>> e.isProposed(tool, None)
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, None))
+            True
+
+        1.1 > 1.0 < 2.0
+
+            >>> e.versionMatch('1.0')
+            False
+            >>> e.isProposed(tool, '1.0')
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, '1.0'))
+            True
+
+        1.1 < 2.0 == 2.0
+
+            >>> e.versionMatch('2.0')
+            False
+            >>> e.isProposed(tool, '2.0')
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, '2.0'))
+            False
+
+    with combined restrictions: 2.0 -> 3.0, false checker
+    -----------------------------------------------------
+
+        >>> e = UpgradeEntity('TITLE', 'PROFILE', '2.0', '3.0', 'DESC', false_checker)
+
+        2.0 <> unknown <> 3.0
+
+            >>> e.versionMatch(None)
+            True
+            >>> e.isProposed(tool, None)
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, None))
+            True
+
+        2.0 > 1.0 < 3.0
+
+            >>> e.versionMatch('1.0')
+            False
+            >>> e.isProposed(tool, '1.0')
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, '1.0'))
+            True
+
+        2.0 == 2.0 < 3.0
+
+            >>> e.versionMatch('2.0') # XXX: True
+            False
+            >>> e.isProposed(tool, '2.0')
+            False
+            >>> bool(_extractStepInfo(tool, 'ID', e, '2.0'))
+            True


Property changes on: Products.GenericSetup/trunk/Products/GenericSetup/tests/upgrade.txt
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native



More information about the Checkins mailing list