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
......@@ -76,23 +76,22 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
"""
return ('erp5_base', 'erp5_pdm', 'erp5_trade', 'erp5_apparel')
def setUpPreferences(self):
portal = self.getPortal()
preferences = getToolByName(portal,'portal_preferences')
system_preference = preferences.newContent(
portal_type = 'System Preference'
)
system_preference.edit(
preferred_apparel_model_variation_base_category_list = ('colour', 'size', 'morphology', 'industrial_phase',),
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,
)
def setUpPreferences(self):
#create apparel variation preferences
portal_preferences = self.getPreferenceTool()
preference = getattr(portal_preferences, 'test_site_preference', None)
if preference is None:
preference = portal_preferences.newContent(portal_type='System Preference',
title='Default Site Preference',
id='test_site_preference')
if preference.getPreferenceState() == 'disabled':
preference.enable()
system_preference.enable()
preference.setPreferredApparelModelVariationBaseCategoryList(('colour', 'size', 'morphology', 'industrial_phase',))
preference.setPreferredApparelClothVariationBaseCategoryList(('size',))
preference.setPreferredApparelComponentVariationBaseCategoryList(('variation',))
if preference.getPreferenceState() == 'disabled':
preference.enable()
transaction.commit()
self.tic()
......
......@@ -68,22 +68,21 @@ class TestOrderMixin:
newSecurityManager(None, user)
def setUpPreferences(self):
portal = self.getPortal()
preferences = getToolByName(portal,'portal_preferences')
system_preference = preferences.newContent(
portal_type = 'System Preference'
)
system_preference.edit(
preferred_apparel_model_variation_base_category_list = ('colour', 'size', 'morphology', 'industrial_phase',),
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()
#create apparel variation preferences
portal_preferences = self.getPreferenceTool()
preference = getattr(portal_preferences, 'test_site_preference', None)
if preference is None:
preference = portal_preferences.newContent(portal_type='System Preference',
title='Default Site Preference',
id='test_site_preference')
if preference.getPreferenceState() == 'disabled':
preference.enable()
preference.setPreferredApparelModelVariationBaseCategoryList(('colour', 'size', 'morphology', 'industrial_phase',))
preference.setPreferredApparelClothVariationBaseCategoryList(('size',))
preference.setPreferredApparelComponentVariationBaseCategoryList(('variation',))
if preference.getPreferenceState() == 'disabled':
preference.enable()
transaction.commit()
self.tic()
......
......@@ -31,7 +31,6 @@ import transaction
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
from Products.CMFCore.utils import getToolByName
from zLOG import LOG
from Products.ERP5Type.tests.Sequence import SequenceList
from DateTime import DateTime
......@@ -75,22 +74,21 @@ class TestResource(ERP5TypeTestCase):
newSecurityManager(None, user)
def setUpPreferences(self):
portal = self.getPortal()
preferences = getToolByName(portal,'portal_preferences')
system_preference = preferences.newContent(
portal_type = 'System Preference'
)
system_preference.edit(
preferred_apparel_model_variation_base_category_list = ('colour', 'size', 'morphology', 'industrial_phase',),
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()
#create apparel variation preferences
portal_preferences = self.getPreferenceTool()
preference = getattr(portal_preferences, 'test_site_preference', None)
if preference is None:
preference = portal_preferences.newContent(portal_type='System Preference',
title='Default Site Preference',
id='test_site_preference')
if preference.getPreferenceState() == 'disabled':
preference.enable()
preference.setPreferredApparelModelVariationBaseCategoryList(('colour', 'size', 'morphology', 'industrial_phase',))
preference.setPreferredApparelClothVariationBaseCategoryList(('size',))
preference.setPreferredApparelComponentVariationBaseCategoryList(('variation',))
if preference.getPreferenceState() == 'disabled':
preference.enable()
transaction.commit()
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