Commit 57879176 authored by Rafael Monnerat's avatar Rafael Monnerat

Update setUp/TearDown for Product Tutorial Funcional Test

It creates and drop currency for the Functional Test related to the
tutorial: user-Howto.Create.and.Manage.Products-HTML5

It defines append preference variation "variation" if it is not present
already at the default system preference. If this test runs after
the Configurator this change is ignored.
parent 30ce97e2
......@@ -85,6 +85,8 @@ return {\'now\': DateTime(),\n
\'link_howto_organisation2_title\': \'ZUITE-TEST-LINK-ORGANISATION-002\',\n
\'product_howto_product_title\': \'ZUITE-TEST-PRODUCT-PRODUCT-001\',\n
\'product_howto_organisation_title\': \'ZUITE-TEST-PRODUCT-ORGANISATION-001\',\n
\'product_howto_currency_title\': \'Euro\',\n
\'product_howto_currency_tag\': \'EUR\',\n
\'sale_howto_product_title\': \'ZUITE-TEST-SALEORDER-PRODUCT-001\',\n
\'sale_howto_organisation_title\': \'ZUITE-TEST-SALEORDER-ORGANISATION-001\',\n
\'sale_howto_organisation2_title\': \'ZUITE-TEST-SALEORDER-ORGANISATION-002\',\n
......
......@@ -53,12 +53,34 @@
<value> <string>if clean:\n
context.Zuite_tearDownProductTest()\n
\n
howto_dict = context.Zuite_getHowToInfo()\n
portal = context.getPortalObject()\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
\n
system_preference = portal.portal_preferences.getActiveSystemPreference()\n
base_category_list = system_preference.getPreferredProductIndividualVariationBaseCategoryList()\n
if \'variation\' not in base_category_list:\n
base_category_list.append(\'variation\')\n
system_preference.setPreferredProductIndividualVariationBaseCategoryList(base_category_list)\n
\n
# check if there is already the euro curency on the instance\n
currency = context.portal_catalog.getResultValue(portal_type=\'Currency\',\n
title=howto_dict[\'product_howto_currency_title\'])\n
if currency is None:\n
currency = portal.currency_module.newContent(portal_type=\'Currency\',\n
title=howto_dict[\'product_howto_currency_title\'],\n
reference=howto_dict[\'product_howto_currency_tag\'],\n
id=howto_dict[\'product_howto_currency_tag\'],\n
base_unit_quantity=0.01)\n
\n
if isTransitionPossible(currency, \'validate\'):\n
currency.validate()\n
\n
\n
organisation = portal.organisation_module.newContent(\n
portal_type=\'Organisation\',\n
title=context.Zuite_getHowToInfo()[\'product_howto_organisation_title\'],\n
corporate_name=context.Zuite_getHowToInfo()[\'product_howto_organisation_title\'])\n
title=howto_dict[\'product_howto_organisation_title\'],\n
corporate_name=howto_dict[\'product_howto_organisation_title\'])\n
organisation.validate()\n
\n
portal.portal_caches.clearAllCache()\n
......
......@@ -52,6 +52,15 @@
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
\n
howto_dict = context.Zuite_getHowToInfo()\n
\n
# remove the currency if it was created by us before\n
currency = context.portal_catalog.getResultValue(portal_type=\'Currency\',\n
title=howto_dict[\'product_howto_currency_title\'],\n
local_roles = \'Owner\')\n
if currency is not None:\n
context.currency_module.deleteContent(currency.getId())\n
\n
# remove the product of the test if existing\n
product_list = context.Zuite_checkPortalCatalog(portal_type=\'Product\', max_count=1,\n
title=context.Zuite_getHowToInfo()[\'product_howto_product_title\'])\n
......
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