[Zope-CVS] CVS: Products/ZopeVersionControl/tests - test_all.py:1.1 testVersionControl.py:1.7

Shane Hathaway shane at zope.com
Fri Jan 30 13:59:41 EST 2004


Update of /cvs-repository/Products/ZopeVersionControl/tests
In directory cvs.zope.org:/tmp/cvs-serv9102/tests

Modified Files:
	testVersionControl.py 
Added Files:
	test_all.py 
Log Message:
Refined the pattern for keeping parts of objects out of version control.

This is a generalization of the mechanism for versioning container
items.  IVersionedContainer is now named INonVersionedData and has
more descriptive method names.

You can also now supply an attribute, __vc_ignore__, that lists the names
of attributes to be ignored when reverting to an earlier revision.



=== Added File Products/ZopeVersionControl/tests/test_all.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Visible Source
# License, Version 1.0 (ZVSL).  A copy of the ZVSL 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.
#
##############################################################################
"""Run all Zope Version Control tests

$Id: test_all.py,v 1.1 2004/01/30 18:59:40 shane Exp $"""

import unittest

from Products.ZopeVersionControl.tests import testVersionControl

try:
    from Products import References
except ImportError:
    # References product is not available
    testReferenceVersioning = None
else:
    # References product is available
    from Products.ZopeVersionControl.tests import testReferenceVersioning


def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(testVersionControl.test_suite())
    if testReferenceVersioning is not None:
        suite.addTest(testReferenceVersioning.test_suite())
    return suite

if __name__ == "__main__":
    unittest.main(defaultTest="test_suite")


=== Products/ZopeVersionControl/tests/testVersionControl.py 1.6 => 1.7 ===
--- Products/ZopeVersionControl/tests/testVersionControl.py:1.6	Mon Jan 19 15:29:08 2004
+++ Products/ZopeVersionControl/tests/testVersionControl.py	Fri Jan 30 13:59:40 2004
@@ -785,7 +785,25 @@
         self.assertEqual(folder1.testattr, 'container_v2')
         self.assertEqual(folder1.folder2.testattr, 'item_v2')
         self.assert_(not hasattr(folder1, 'document3'))
-        
+
+
+    def testNonVersionedAttribute(self):
+        # Test a non-version-controlled attribute mixed with
+        # a version-controlled attribute.
+        self.document1.extra_attr = 'v1'
+        self.document1.__vc_ignore__ = ('__ac_local_roles__',)
+        self.document1.__ac_local_roles__ = {'sam': ['Manager',]}
+        repository = self.repository
+        document = repository.applyVersionControl(self.document1)
+        info = repository.getVersionInfo(document)
+        first_version = info.version_id
+        repository.checkoutResource(document)
+        self.document1.extra_attr = 'v2'
+        self.document1.__ac_local_roles__ = {}
+        repository.checkinResource(document)
+        repository.updateResource(document, first_version)
+        self.assertEqual(document.extra_attr, 'v1')
+        self.assertEqual(document.__ac_local_roles__, {})
 
 
 class VersionControlTestsWithCommits(VersionControlTests):




More information about the Zope-CVS mailing list