diff --git a/product/ERP5OOo/tests/testDms.py b/product/ERP5OOo/tests/testDms.py index a6fd52ee0d79ce0cd01e79c47f596932e23bc125..edaec49f222eabdafda84796f3646654c45d2869 100644 --- a/product/ERP5OOo/tests/testDms.py +++ b/product/ERP5OOo/tests/testDms.py @@ -65,8 +65,8 @@ RUN_ALL_TEST = 1 conversion_server_host = ('127.0.0.1', 8008) TEST_FILES_HOME = os.path.join(os.path.dirname(__file__), 'test_document') -FILE_NAME_REGULAR_EXPRESSION = "(?P<reference>[A-Z]{3,6})-(?P<language>[a-z]{2})-(?P<version>[0-9]{3})" -REFERENCE_REGULAR_EXPRESSION = "(?P<reference>[A-Z]{3,6})(-(?P<language>[a-z]{2}))?(-(?P<version>[0-9]{3}))?" +FILE_NAME_REGULAR_EXPRESSION = "(?P<reference>[A-Z]{3,10})-(?P<language>[a-z]{2})-(?P<version>[0-9]{3})" +REFERENCE_REGULAR_EXPRESSION = "(?P<reference>[A-Z]{3,10})(-(?P<language>[a-z]{2}))?(-(?P<version>[0-9]{3}))?" def printAndLog(msg): @@ -379,29 +379,76 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional): """ # XXX this test should be extended to check more elaborate language selection if not run: return - raise NotImplementedError printAndLog('\nTest Implicit Relations') # create docs to be referenced: # (1) TEST, 002, en + filename = 'TEST-en-002.odt' + file = makeFileUpload(filename) + document1 = self.portal.portal_contributions.newContent(file=file) + # (2) TEST, 002, fr + filename = 'TEST-fr-002.odt' + file = makeFileUpload(filename) + document2 = self.portal.portal_contributions.newContent(file=file) + # (3) TEST, 003, en + filename = 'TEST-en-003.odt' + file = makeFileUpload(filename) + document3 = self.portal.portal_contributions.newContent(file=file) + # create docs to contain references in text_content: # REF, 001, en; "I use reference to look up TEST" + filename = 'REF-en-001.odt' + file = makeFileUpload(filename) + document4 = self.portal.portal_contributions.newContent(file=file) + # REF, 002, en; "I use reference to look up TEST" + filename = 'REF-en-002.odt' + file = makeFileUpload(filename) + document5 = self.portal.portal_contributions.newContent(file=file) + # REFLANG, 001, en: "I use reference and language to look up TEST-fr" + filename = 'REFLANG-en-001.odt' + file = makeFileUpload(filename) + document6 = self.portal.portal_contributions.newContent(file=file) + # REFVER, 001, en: "I use reference and version to look up TEST-002" + filename = 'REFVER-en-001.odt' + file = makeFileUpload(filename) + document7 = self.portal.portal_contributions.newContent(file=file) + # REFVERLANG, 001, en: "I use reference, version and language to look up TEST-002-en" + filename = 'REFVERLANG-en-001.odt' + file = makeFileUpload(filename) + document8 = self.portal.portal_contributions.newContent(file=file) + + get_transaction().commit() + self.tic() printAndLog('\nTesting Implicit Predecessors') # the implicit predecessors should be: # for (1): REF-002, REFVER, REFVERLANG + self.assertSameSet([document5, document7, document8], + document1.getImplicitPredecessorValueList()) # for (2): REF-002, REFLANG, REFVER + self.assertSameSet([document5, document6, document7], + document2.getImplicitPredecessorValueList()) # for (3): REF-002 + self.assertSameSet([document5], + document3.getImplicitPredecessorValueList()) printAndLog('\nTesting Implicit Successors') # the implicit successors should be: # for REF: (3) + self.assertSameSet([document3], + document5.getImplicitSuccessorValueList()) # for REFLANG: (2) + self.assertSameSet([document2], + document6.getImplicitSuccessorValueList()) # for REFVER: (3) + self.assertSameSet([document3], + document7.getImplicitSuccessorValueList()) # for REFVERLANG: (3) + self.assertSameSet([document3], + document8.getImplicitSuccessorValueList()) def testOOoDocument_get_size(self): # test get_size on OOoDocument diff --git a/product/ERP5OOo/tests/test_document/REF-en-001.odt b/product/ERP5OOo/tests/test_document/REF-en-001.odt new file mode 100644 index 0000000000000000000000000000000000000000..e37b305cd005a9940bfb18ebf81227cb034c2de1 Binary files /dev/null and b/product/ERP5OOo/tests/test_document/REF-en-001.odt differ diff --git a/product/ERP5OOo/tests/test_document/REF-en-002.odt b/product/ERP5OOo/tests/test_document/REF-en-002.odt new file mode 100644 index 0000000000000000000000000000000000000000..6ac5fd3a9beed6d2f3a1309bebf75b6e18252de8 Binary files /dev/null and b/product/ERP5OOo/tests/test_document/REF-en-002.odt differ diff --git a/product/ERP5OOo/tests/test_document/REFLANG-en-001.odt b/product/ERP5OOo/tests/test_document/REFLANG-en-001.odt new file mode 100644 index 0000000000000000000000000000000000000000..60221bf6745621b52775f9bc029cf695b262ba16 Binary files /dev/null and b/product/ERP5OOo/tests/test_document/REFLANG-en-001.odt differ diff --git a/product/ERP5OOo/tests/test_document/REFVER-en-001.odt b/product/ERP5OOo/tests/test_document/REFVER-en-001.odt new file mode 100644 index 0000000000000000000000000000000000000000..c1f2f8bacd911ea3e4e93c045a0dda03c0389845 Binary files /dev/null and b/product/ERP5OOo/tests/test_document/REFVER-en-001.odt differ diff --git a/product/ERP5OOo/tests/test_document/REFVERLANG-en-001.odt b/product/ERP5OOo/tests/test_document/REFVERLANG-en-001.odt new file mode 100644 index 0000000000000000000000000000000000000000..998bdaece75d6c2032ea11c4f80c7d453d66dca4 Binary files /dev/null and b/product/ERP5OOo/tests/test_document/REFVERLANG-en-001.odt differ diff --git a/product/ERP5OOo/tests/test_document/TEST-en-002.odt b/product/ERP5OOo/tests/test_document/TEST-en-002.odt new file mode 100644 index 0000000000000000000000000000000000000000..9854e6ccbf52c0ea977ba37de0bab1d4616d070f Binary files /dev/null and b/product/ERP5OOo/tests/test_document/TEST-en-002.odt differ diff --git a/product/ERP5OOo/tests/test_document/TEST-en-003.odt b/product/ERP5OOo/tests/test_document/TEST-en-003.odt new file mode 100644 index 0000000000000000000000000000000000000000..9854e6ccbf52c0ea977ba37de0bab1d4616d070f Binary files /dev/null and b/product/ERP5OOo/tests/test_document/TEST-en-003.odt differ diff --git a/product/ERP5OOo/tests/test_document/TEST-fr-002.odt b/product/ERP5OOo/tests/test_document/TEST-fr-002.odt new file mode 100644 index 0000000000000000000000000000000000000000..9854e6ccbf52c0ea977ba37de0bab1d4616d070f Binary files /dev/null and b/product/ERP5OOo/tests/test_document/TEST-fr-002.odt differ