Commit 67f7ac37 authored by Fabien Morin's avatar Fabien Morin

fix some mistakes :

- indentation pb
- do not create one preference for one test
- enable preference only if it's disable


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29451 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 086d18cf
...@@ -77,22 +77,21 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): ...@@ -77,22 +77,21 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
return ('erp5_base', 'erp5_pdm', 'erp5_trade', 'erp5_apparel') return ('erp5_base', 'erp5_pdm', 'erp5_trade', 'erp5_apparel')
def setUpPreferences(self): def setUpPreferences(self):
portal = self.getPortal() #create apparel variation preferences
preferences = getToolByName(portal,'portal_preferences') portal_preferences = self.getPreferenceTool()
preference = getattr(portal_preferences, 'test_site_preference', None)
system_preference = preferences.newContent( if preference is None:
portal_type = 'System Preference' preference = portal_preferences.newContent(portal_type='System Preference',
) title='Default Site Preference',
id='test_site_preference')
system_preference.edit( if preference.getPreferenceState() == 'disabled':
preferred_apparel_model_variation_base_category_list = ('colour', 'size', 'morphology', 'industrial_phase',), preference.enable()
preferred_apparel_cloth_variation_base_category_list = ('size',),
preferred_apparel_component_variation_base_category_list = ('variation',), preference.setPreferredApparelModelVariationBaseCategoryList(('colour', 'size', 'morphology', 'industrial_phase',))
preferred_apparel_colour_variation_base_category_list = ('colour',), preference.setPreferredApparelClothVariationBaseCategoryList(('size',))
priority = 1, preference.setPreferredApparelComponentVariationBaseCategoryList(('variation',))
) if preference.getPreferenceState() == 'disabled':
preference.enable()
system_preference.enable()
transaction.commit() transaction.commit()
self.tic() self.tic()
......
...@@ -68,22 +68,21 @@ class TestOrderMixin: ...@@ -68,22 +68,21 @@ class TestOrderMixin:
newSecurityManager(None, user) newSecurityManager(None, user)
def setUpPreferences(self): def setUpPreferences(self):
portal = self.getPortal() #create apparel variation preferences
preferences = getToolByName(portal,'portal_preferences') portal_preferences = self.getPreferenceTool()
preference = getattr(portal_preferences, 'test_site_preference', None)
system_preference = preferences.newContent( if preference is None:
portal_type = 'System Preference' preference = portal_preferences.newContent(portal_type='System Preference',
) title='Default Site Preference',
id='test_site_preference')
system_preference.edit( if preference.getPreferenceState() == 'disabled':
preferred_apparel_model_variation_base_category_list = ('colour', 'size', 'morphology', 'industrial_phase',), preference.enable()
preferred_apparel_cloth_variation_base_category_list = ('size',),
preferred_apparel_component_variation_base_category_list = ('variation',), preference.setPreferredApparelModelVariationBaseCategoryList(('colour', 'size', 'morphology', 'industrial_phase',))
preferred_apparel_colour_variation_base_category_list = ('colour',), preference.setPreferredApparelClothVariationBaseCategoryList(('size',))
priority = 1, preference.setPreferredApparelComponentVariationBaseCategoryList(('variation',))
) if preference.getPreferenceState() == 'disabled':
preference.enable()
system_preference.enable()
transaction.commit() transaction.commit()
self.tic() self.tic()
......
...@@ -31,7 +31,6 @@ import transaction ...@@ -31,7 +31,6 @@ import transaction
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.CMFCore.utils import getToolByName
from zLOG import LOG from zLOG import LOG
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from DateTime import DateTime from DateTime import DateTime
...@@ -75,22 +74,21 @@ class TestResource(ERP5TypeTestCase): ...@@ -75,22 +74,21 @@ class TestResource(ERP5TypeTestCase):
newSecurityManager(None, user) newSecurityManager(None, user)
def setUpPreferences(self): def setUpPreferences(self):
portal = self.getPortal() #create apparel variation preferences
preferences = getToolByName(portal,'portal_preferences') portal_preferences = self.getPreferenceTool()
preference = getattr(portal_preferences, 'test_site_preference', None)
system_preference = preferences.newContent( if preference is None:
portal_type = 'System Preference' preference = portal_preferences.newContent(portal_type='System Preference',
) title='Default Site Preference',
id='test_site_preference')
system_preference.edit( if preference.getPreferenceState() == 'disabled':
preferred_apparel_model_variation_base_category_list = ('colour', 'size', 'morphology', 'industrial_phase',), preference.enable()
preferred_apparel_cloth_variation_base_category_list = ('size',),
preferred_apparel_component_variation_base_category_list = ('variation',),
preferred_apparel_colour_variation_base_category_list = ('colour',),
priority = 1,
)
system_preference.enable() preference.setPreferredApparelModelVariationBaseCategoryList(('colour', 'size', 'morphology', 'industrial_phase',))
preference.setPreferredApparelClothVariationBaseCategoryList(('size',))
preference.setPreferredApparelComponentVariationBaseCategoryList(('variation',))
if preference.getPreferenceState() == 'disabled':
preference.enable()
transaction.commit() transaction.commit()
self.tic() self.tic()
......
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