Commit 769dd716 authored by Ayush Tiwari's avatar Ayush Tiwari

bt5_prototype: Update bt5 list in portal_component tests

parent b28e5e2e
...@@ -52,6 +52,8 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -52,6 +52,8 @@ class TestBusinessPackage(ERP5TypeTestCase):
""" """
return ( return (
'erp5_base', 'erp5_base',
'erp5_core',
'erp5_property_sheets',
'erp5_business_package', 'erp5_business_package',
) )
...@@ -62,7 +64,6 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -62,7 +64,6 @@ class TestBusinessPackage(ERP5TypeTestCase):
# here, you can create the categories and objects your test will depend on # here, you can create the categories and objects your test will depend on
#self.export_dir = tempfile.mkdtmp(dir=tests_home) #self.export_dir = tempfile.mkdtmp(dir=tests_home)
self.portal = self.getPortalObject() self.portal = self.getPortalObject()
self.package = self._createBusinessPackage()
def beforeTearDown(self): def beforeTearDown(self):
try: try:
...@@ -82,7 +83,7 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -82,7 +83,7 @@ class TestBusinessPackage(ERP5TypeTestCase):
description='package for live test') description='package for live test')
return package return package
def _buildAndExportBusinessPackage(self): def _buildAndExportBusinessPackage(self, package):
""" """
Builds and exports Business Package to a given export directory Builds and exports Business Package to a given export directory
""" """
...@@ -90,24 +91,25 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -90,24 +91,25 @@ class TestBusinessPackage(ERP5TypeTestCase):
# Expected result should be while building the path object items # Expected result should be while building the path object items
# are going to be exported as XML(?) # are going to be exported as XML(?)
self.tic() self.tic()
self.built_package = self.package.build() package.build()
self.tic() self.tic()
# Export package (not needed) # Export package (not needed)
#self.package.export(path=self.export_dir, local=True) #self.package.export(path=self.export_dir, local=True)
#self.tic() #self.tic()
def _installBusinessPackage(self): def _installBusinessPackage(self, package):
""" """
Install the package from its built version. Install the package from its built version.
Expected to install the PathTemplateObject items Expected to install the PathTemplateObject items
""" """
self.package.install() package.install()
def test_fileImportAndReinstallForDocument(self): def test_fileImportAndReinstallForDocument(self):
""" """
Test Business Package build and install with test document Test Business Package build and install with test document
""" """
package = self._createBusinessPackage()
document_file = self.portal.document_module.newContent( document_file = self.portal.document_module.newContent(
portal_type = 'File', portal_type = 'File',
title = 'Test Document', title = 'Test Document',
...@@ -117,10 +119,10 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -117,10 +119,10 @@ class TestBusinessPackage(ERP5TypeTestCase):
self.tic() self.tic()
file_path = document_file.getRelativeUrl() file_path = document_file.getRelativeUrl()
self.package.edit(template_path_list=[file_path,]) package.edit(template_path_list=[file_path,])
# Build package # Build package
self._buildAndExportBusinessPackage() self._buildAndExportBusinessPackage(package)
# Delete document from site # Delete document from site
self.portal.document_module.manage_delObjects([document_file.getId(),]) self.portal.document_module.manage_delObjects([document_file.getId(),])
...@@ -130,7 +132,7 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -130,7 +132,7 @@ class TestBusinessPackage(ERP5TypeTestCase):
self.assertRaises(KeyError, lambda: self.portal.restrictedTraverse(file_path)) self.assertRaises(KeyError, lambda: self.portal.restrictedTraverse(file_path))
# Install package # Install package
self._installBusinessPackage() self._installBusinessPackage(package)
# Test if the file is back # Test if the file is back
self.assertIsNotNone(self.portal.restrictedTraverse(file_path)) self.assertIsNotNone(self.portal.restrictedTraverse(file_path))
......
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