Commit bb50d453 authored by Ayush Tiwari's avatar Ayush Tiwari

bt5_prototype: Update tests for Business Package

parent 4df25a91
...@@ -25,10 +25,8 @@ ...@@ -25,10 +25,8 @@
# #
############################################################################## ##############################################################################
import tempfile
from Products.ERP5Type.tests.runUnitTest import tests_home
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
import time
class TestBusinessPackage(ERP5TypeTestCase): class TestBusinessPackage(ERP5TypeTestCase):
""" """
...@@ -62,7 +60,7 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -62,7 +60,7 @@ class TestBusinessPackage(ERP5TypeTestCase):
This is ran before anything, used to set the environment This is ran before anything, used to set the environment
""" """
# 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() self.package = self._createBusinessPackage()
...@@ -75,9 +73,10 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -75,9 +73,10 @@ class TestBusinessPackage(ERP5TypeTestCase):
pass pass
def _createBusinessPackage(self): def _createBusinessPackage(self):
package = self.portal.newContent(portal_type='Business Package') new_id = 'package_%s'%str(time.time())
self.assertTrue(package.getBuildingState() == 'draft') package = self.portal.newContent(id=new_id, portal_type='Business Package')
self.assertTrue(package.getInstallationState() == 'not_installed') #self.assertTrue(package.getBuildingState() == 'draft')
#self.assertTrue(package.getInstallationState() == 'not_installed')
package.edit(title ='test_package', package.edit(title ='test_package',
version='1.0', version='1.0',
description='package for live test') description='package for live test')
...@@ -128,7 +127,7 @@ class TestBusinessPackage(ERP5TypeTestCase): ...@@ -128,7 +127,7 @@ class TestBusinessPackage(ERP5TypeTestCase):
self.tic() self.tic()
# Test if the file is gone # Test if the file is gone
self.assertIsNone(self.portal.restrictedTraverse(file_path)) self.assertRaises(KeyError, lambda: self.portal.restrictedTraverse(file_path))
# Install package # Install package
self._installBusinessPackage() self._installBusinessPackage()
......
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