Commit c00b7b99 authored by Aurel's avatar Aurel

add a method to get the archive used for the current catalog, add a

test for it


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17894 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 87a85ded
...@@ -52,6 +52,7 @@ class ArchiveTool(BaseTool): ...@@ -52,6 +52,7 @@ class ArchiveTool(BaseTool):
manage_overview = DTMLFile( 'explainArchiveTool', _dtmldir) manage_overview = DTMLFile( 'explainArchiveTool', _dtmldir)
def getSQLCatalogIdList(self): def getSQLCatalogIdList(self):
""" """
Wrapper to CatalogTool method Wrapper to CatalogTool method
...@@ -73,6 +74,19 @@ class ArchiveTool(BaseTool): ...@@ -73,6 +74,19 @@ class ArchiveTool(BaseTool):
validation_state="ready")] validation_state="ready")]
def getCurrentArchive(self):
"""
Return the archive used for the current catalog
"""
current_catalog = self.portal_catalog.default_sql_catalog_id
current_archive_list = [x.getObject() for x in self.searchFolder(validation_state="validated") \
if x.getCatalogId() == current_catalog]
if len(current_archive_list) == 0:
return None
else:
return current_archive_list[0]
def getArchiveList(self): def getArchiveList(self):
""" """
Return the list of archive use by catalog Return the list of archive use by catalog
......
...@@ -351,6 +351,9 @@ class TestArchive(InventoryAPITestCase): ...@@ -351,6 +351,9 @@ class TestArchive(InventoryAPITestCase):
self.checkRelativeUrlNotInSQLPathList(path_list, connection_id=self.new_connection_id) self.checkRelativeUrlNotInSQLPathList(path_list, connection_id=self.new_connection_id)
self.checkRelativeUrlNotInSQLPathList(path_list, connection_id=self.archive_connection_id) self.checkRelativeUrlNotInSQLPathList(path_list, connection_id=self.archive_connection_id)
# check the current archive
self.assertEquals(portal_archive.getCurrentArchive(), dest)
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
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