Commit fa5e107e authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_pdm: add get preferred variation vategory test

parent 16a5460d
Pipeline #25928 failed with stage
in 0 seconds
...@@ -169,6 +169,7 @@ class ResourceVariationTestCase(ERP5TypeTestCase): ...@@ -169,6 +169,7 @@ class ResourceVariationTestCase(ERP5TypeTestCase):
preference.setPreferredProductOptionalVariationBaseCategory(value) preference.setPreferredProductOptionalVariationBaseCategory(value)
preference.setPreferredServiceOptionalVariationBaseCategory(value) preference.setPreferredServiceOptionalVariationBaseCategory(value)
preference.setPreferredComponentOptionalVariationBaseCategory(value) preference.setPreferredComponentOptionalVariationBaseCategory(value)
self.preference = preference
# all this available to catalog # all this available to catalog
...@@ -702,6 +703,26 @@ class TestResourceVariation(ResourceVariationTestCase): ...@@ -702,6 +703,26 @@ class TestResourceVariation(ResourceVariationTestCase):
individual_variation_base_category='individual_aspect') individual_variation_base_category='individual_aspect')
self._testResourceVariation(component) self._testResourceVariation(component)
def testResourceGetVariationBaseCategoryValueAfterChangePreference(self):
# Resource Variation test.
self.logMessage('testResourceGetVariationBaseCategoryValueAfterChangePreference')
product = self._makeOneResource(
id='6',
portal_type='Product',
title='Product Six',
validation_state='validated')
self.tic()
self.assertEqual([('Individual Aspect', 'individual_aspect')], product.Resource_getIndividualVariationBaseCategoryItemList())
self.assertEqual([('Optional Colour', 'option_colour')], product.Resource_getOptionalVariationBaseCategoryItemList())
self.assertEqual([('Required Size', 'required_size')], product.Resource_getVariationBaseCategoryItemList())
self.preference.setPreferredProductIndividualVariationBaseCategoryList([])
self.preference.setPreferredProductVariationBaseCategoryList([])
self.preference.setPreferredProductOptionalVariationBaseCategoryList([])
self.tic()
self.assertEqual([], product.Resource_getIndividualVariationBaseCategoryItemList())
self.assertEqual([], product.Resource_getOptionalVariationBaseCategoryItemList())
self.assertEqual([], product.Resource_getVariationBaseCategoryItemList())
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestResourceVariation)) suite.addTest(unittest.makeSuite(TestResourceVariation))
......
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