Commit 0abd1737 authored by Jérome Perrin's avatar Jérome Perrin

add tests for version comparison


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15899 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7ff1bdab
...@@ -4198,6 +4198,30 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -4198,6 +4198,30 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) sequence_list.play(self, quiet=quiet)
def test_CompareVersions(self):
"""Tests compare version on template tool. """
compareVersions = self.getPortal().portal_templates.compareVersions
self.assertEquals(0, compareVersions('1', '1'))
self.assertEquals(0, compareVersions('1.2', '1.2'))
self.assertEquals(0, compareVersions('1.2rc3', '1.2rc3'))
self.assertEquals(0, compareVersions('1.0.0', '1.0'))
self.assertEquals(-1, compareVersions('1.0', '1.0.1'))
self.assertEquals(-1, compareVersions('1.0rc1', '1.0'))
self.assertEquals(-1, compareVersions('1.0a', '1.0.1'))
self.assertEquals(-1, compareVersions('1.1', '2.0'))
def test_CompareVersionStrings(self):
"""Test compareVersionStrings on template tool"""
compareVersionStrings = \
self.getPortal().portal_templates.compareVersionStrings
self.assertTrue(compareVersionStrings('1.1', '> 1.0'))
self.assertFalse(compareVersionStrings('1.1rc1', '= 1.0'))
self.assertFalse(compareVersionStrings('1.0rc1', '> 1.0'))
if __name__ == '__main__': if __name__ == '__main__':
framework() framework()
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment