Commit 0ff27260 authored by Yusei Tahara's avatar Yusei Tahara

Update test for change of specification.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19326 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent eaced69f
...@@ -351,6 +351,7 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -351,6 +351,7 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional):
except for similarity cloud which we test. except for similarity cloud which we test.
""" """
if not run: return if not run: return
printAndLog('\nTest Explicit Relations') printAndLog('\nTest Explicit Relations')
# create test documents: # create test documents:
# (1) TEST, 002, en # (1) TEST, 002, en
...@@ -385,6 +386,10 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -385,6 +386,10 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional):
""" """
# XXX this test should be extended to check more elaborate language selection # XXX this test should be extended to check more elaborate language selection
if not run: return if not run: return
def sqlresult_to_document_list(result):
return [i.getObject() for i in result]
printAndLog('\nTest Implicit Relations') printAndLog('\nTest Implicit Relations')
# create docs to be referenced: # create docs to be referenced:
# (1) TEST, 002, en # (1) TEST, 002, en
...@@ -431,30 +436,48 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -431,30 +436,48 @@ class TestDocument(ERP5TypeTestCase, ZopeTestCase.Functional):
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
printAndLog('\nTesting Implicit Predecessors') printAndLog('\nTesting Implicit Predecessors')
# the implicit predecessor will find documents by reference.
# version and language are not used.
# the implicit predecessors should be: # the implicit predecessors should be:
# for (1): REF-002, REFVER, REFVERLANG
self.assertSameSet([document5, document7, document8], # for (1): REF-002, REFLANG, REFVER, REFVERLANG
document1.getImplicitPredecessorValueList()) # document1's reference is TEST. getImplicitPredecessorValueList will
# for (2): REF-002, REFLANG, REFVER # return latest version of documents which contains string "TEST".
self.assertSameSet([document5, document6, document7], self.assertSameSet(
document2.getImplicitPredecessorValueList()) [document5, document6, document7, document8],
# for (3): REF-002 sqlresult_to_document_list(document1.getImplicitPredecessorValueList()))
self.assertSameSet([document5],
document3.getImplicitPredecessorValueList()) # clear transactional variable cache
get_transaction().commit()
printAndLog('\nTesting Implicit Successors') printAndLog('\nTesting Implicit Successors')
# the implicit successors should be: # the implicit successors should be return document with appropriate
# for REF: (3) # language.
self.assertSameSet([document3],
document5.getImplicitSuccessorValueList()) # if user language is 'en'.
# for REFLANG: (2) self.portal.Localizer.changeLanguage('en')
self.assertSameSet([document2],
document6.getImplicitSuccessorValueList()) self.assertSameSet(
# for REFVER: (3) [document3],
self.assertSameSet([document3], sqlresult_to_document_list(document5.getImplicitSuccessorValueList()))
document7.getImplicitSuccessorValueList())
# for REFVERLANG: (3) # clear transactional variable cache
self.assertSameSet([document3], get_transaction().commit()
document8.getImplicitSuccessorValueList())
# if user language is 'fr'.
self.portal.Localizer.changeLanguage('fr')
self.assertSameSet(
[document2],
sqlresult_to_document_list(document5.getImplicitSuccessorValueList()))
# clear transactional variable cache
get_transaction().commit()
# if user language is 'ja'.
self.portal.Localizer.changeLanguage('ja')
self.assertSameSet(
[document3],
sqlresult_to_document_list(document5.getImplicitSuccessorValueList()))
def testOOoDocument_get_size(self): def testOOoDocument_get_size(self):
# test get_size on OOoDocument # test get_size on OOoDocument
......
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