Commit 852b0583 authored by Rafael Monnerat's avatar Rafael Monnerat Committed by Alain Takoudjou

slapos_erp5: Makes easy dump and compare difference on production

parent b5693986
portal = context.getPortalObject()
import difflib
def resolveDiff(title, expected_file, found):
expected = str(expected_file.data)
return """########################################################################
# %s
########################################################################
%s
########################################################################
""" % (title, '\n'.join(difflib.unified_diff(expected.split("\n"), found.split("\n"))))
if show_all or configuration == "alarm":
expected_file = portal.expected_alarm_tool_dumped_configuration
found = portal.ERP5Site_dumpAlarmToolConfiguration()
print resolveDiff("Alarm Configuration Diff", expected_file, found)
if show_all or configuration == "builder":
expected_file = portal.expected_builder_dumped_configuration
found = portal.ERP5Site_dumpBuilderList()
print resolveDiff("Builder Configuration Diff", expected_file, found)
if show_all or configuration == "bt":
expected_file = portal.expected_business_template_dumped_configuration
found = portal.ERP5Site_dumpInstalledBusinessTemplateList()
print resolveDiff("Business Template Configuration Diff", expected_file, found)
if show_all or configuration == "order_builder":
expected_file = portal.expected_order_builder_dumped_configuration
found = portal.ERP5Site_dumpOrderBuilderList()
print resolveDiff("Order Builder Configuration Diff", expected_file, found)
if show_all or configuration == "property_sheet":
expected_file = portal.expected_property_sheet_dumped_configuration
found = portal.ERP5Site_dumpPropertySheetList()
print resolveDiff("Property Sheet Configuration Diff", expected_file, found)
if show_all or configuration == "skins":
expected_file = portal.expected_portal_skins_dumped_configuration
found = portal.ERP5Site_dumpPortalSkinsContent()
print resolveDiff("Skins Configuration Diff", expected_file, found)
if show_all or configuration == "actions":
expected_file = portal.expected_type_actions_dumped_configuration
found = portal.ERP5Site_dumpPortalTypeActionList()
print resolveDiff("Portal Type Actions Configuration Diff", expected_file, found)
if show_all or configuration == "portal_type":
expected_file = portal.expected_portal_type_dumped_configuration
found = portal.ERP5Site_dumpPortalTypeList()
print resolveDiff("Portal Type Configuration Diff", expected_file, found)
if show_all or configuration == "role":
expected_file = portal.expected_role_dumped_configuration
found = portal.ERP5Site_dumpPortalTypeRoleList()
print resolveDiff("Role Configuration Diff", expected_file, found)
if show_all or configuration == "rule":
expected_file = portal.expected_rule_dumped_configuration
found = portal.ERP5Site_dumpRuleTesterList()
print resolveDiff("Rule Configuration Diff", expected_file, found)
if show_all or configuration == "skin_property":
expected_file = portal.expected_skin_property_dumped_configuration
found = portal.ERP5Site_dumpSkinProperty()
print resolveDiff("Skin Property Configuration Diff", expected_file, found)
if show_all or configuration == "workflow":
expected_file = portal.expected_workflow_dumped_configuration
found = portal.ERP5Site_dumpWorkflowChain()
print resolveDiff("Workflow Configuration Diff", expected_file, found)
return printed
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>configuration=None, show_all=True</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_assertDumpedConfiguration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>expected_alarm_tool_dumped_configuration</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>expected_builder_dumped_configuration</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>expected_builder_dumped_configuration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
erp5_access_token
erp5_accounting
erp5_accounting_l10n_fr
erp5_ace_editor
erp5_administration
erp5_base
erp5_bearer_token
erp5_code_mirror
erp5_commerce
erp5_computer_immobilisation
erp5_configurator
erp5_content_translation
erp5_core
erp5_core_proxy_field_legacy
erp5_credential
erp5_credential_oauth2
erp5_crm
erp5_data_set
erp5_deferred_style
erp5_dhtml_style
erp5_dms
erp5_font
erp5_forge
erp5_full_text_myisam_catalog
erp5_hal_json_style
erp5_ingestion
erp5_ingestion_mysql_innodb_catalog
erp5_invoicing
erp5_item
erp5_jquery
erp5_jquery_plugin_colorpicker
erp5_jquery_plugin_elastic
erp5_jquery_plugin_jqchart
erp5_jquery_plugin_mbmenu
erp5_jquery_plugin_sheet
erp5_jquery_sheet_editor
erp5_jquery_ui
erp5_km
erp5_knowledge_pad
erp5_l10n_fr
erp5_l10n_zh
erp5_movement_table_catalog
erp5_mysql_innodb_catalog
erp5_oauth
erp5_oauth_facebook_login
erp5_oauth_google_login
erp5_ods_style
erp5_odt_style
erp5_ooo_import
erp5_open_trade
erp5_payzen_secure_payment
erp5_pdm
erp5_project
erp5_property_sheets
erp5_rss_style
erp5_secure_payment
erp5_security_uid_innodb_catalog
erp5_simplified_invoicing
erp5_simulation
erp5_software_pdm
erp5_svg_editor
erp5_system_event
erp5_tiosafe_core
erp5_trade
erp5_ui_test_core
erp5_upgrader
erp5_web
erp5_web_download_theme
erp5_web_renderjs_ui
erp5_web_service
erp5_web_shacache
erp5_web_shadir
erp5_workflow
erp5_xhtml_style
slapos_accounting
slapos_category
slapos_cloud
slapos_configurator
slapos_crm
slapos_ecoallocation
slapos_erp5
slapos_jio
slapos_l10n_zh
slapos_payzen
slapos_pdm
slapos_rss_style
slapos_slap_tool
slapos_subscription_request
slapos_upgrader
slapos_web
slapos_web_deploy
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>expected_business_template_dumped_configuration</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>expected_business_template_dumped_configuration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
slapos_payment_transaction_builder
Title: Payment Builder
Simulation Select Method: OrderBuilder_generateUnrelatedInvoiceList
Delivery Select Method: None
After Generation Script: PaymentTransaction_postOrderBuild
Delivery Module Before Building Script: None
slapos_payment_transaction_builder
Id: category_movement_group_on_delivery
Title: category_movement_group_on_delivery
Type: Category Movement Group
Collect Order Group: delivery
Tested Properties: ['causality', 'destination_payment', 'destination_section', 'price_currency', 'resource', 'source_payment', 'source_section', 'specialise', 'payment_mode']
Update Always: 0
slapos_payment_transaction_builder
Id: category_movement_group_on_line
Title: category_movement_group_on_line
Type: Category Movement Group
Collect Order Group: line
Tested Properties: ['destination', 'source']
Update Always: 0
slapos_payment_transaction_builder
Id: property_movement_group_on_delivery
Title: property_movement_group_on_delivery
Type: Property Movement Group
Collect Order Group: delivery
Tested Properties: ['start_date', 'stop_date']
Update Always: 0
slapos_aggregated_delivery_builder
Title: SlapOS Aggregated Delivery Builder
Simulation Select Method: OrderBuilder_generateSlapOSAggregatedMovementList
Delivery Select Method: OrderBuilder_selectSlapOSAggregatedDeliveryList
After Generation Script: SalePackingList_postSlapOSAggregatedDeliveryBuilder
Delivery Module Before Building Script: None
slapos_aggregated_delivery_builder
Id: category_movement_group_on_delivery
Title: category_movement_group_on_delivery
Type: Category Movement Group
Collect Order Group: delivery
Tested Properties: ['destination', 'destination_decision', 'destination_section', 'price_currency', 'source', 'source_section', 'specialise', 'causality']
Update Always: 0
slapos_aggregated_delivery_builder
Id: category_movement_group_on_line
Title: category_movement_group_on_line
Type: Category Movement Group
Collect Order Group: line
Tested Properties: ['resource']
Update Always: 0
slapos_aggregated_delivery_builder
Id: property_movement_group_on_line
Title: property_movement_group_on_line
Type: Property Movement Group
Collect Order Group: line
Tested Properties: ['price']
Update Always: 0
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>expected_order_builder_dumped_configuration</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>expected_order_builder_dumped_configuration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>expected_portal_skins_dumped_configuration</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>expected_portal_skins_dumped_configuration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>expected_portal_type_dumped_configuration</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>expected_portal_type_dumped_configuration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>expected_property_sheet_dumped_configuration</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>expected_property_sheet_dumped_configuration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>expected_role_dumped_configuration</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>expected_role_dumped_configuration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>expected_rule_dumped_configuration</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>expected_rule_dumped_configuration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>expected_skin_property_dumped_configuration</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>expected_skin_property_dumped_configuration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>expected_type_actions_dumped_configuration</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>expected_type_actions_dumped_configuration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>expected_workflow_dumped_configuration</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>expected_workflow_dumped_configuration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -19,25 +19,26 @@ class TestSlapOSDump(SlapOSTestCaseMixin):
def test(self):
issue_count = 0
for dump in [
'ERP5Site_dumpAlarmToolConfiguration',
'ERP5Site_dumpBuilderList',
'ERP5Site_dumpInstalledBusinessTemplateList',
'ERP5Site_dumpOrderBuilderList',
'ERP5Site_dumpPortalTypeActionList',
'ERP5Site_dumpPortalTypeList',
'ERP5Site_dumpPortalTypeRoleList',
'ERP5Site_dumpPropertySheetList',
'ERP5Site_dumpRuleTesterList',
'ERP5Site_dumpSkinProperty',
'ERP5Site_dumpWorkflowChain',
for dump, filename in [
('ERP5Site_dumpAlarmToolConfiguration', 'expected_alarm_tool_dumped_configuration'),
('ERP5Site_dumpBuilderList', 'expected_builder_dumped_configuration'),
('ERP5Site_dumpInstalledBusinessTemplateList', 'expected_business_template_dumped_configuration'),
('ERP5Site_dumpOrderBuilderList', 'expected_order_builder_dumped_configuration'),
('ERP5Site_dumpPortalTypeActionList', 'expected_type_actions_dumped_configuration'),
('ERP5Site_dumpPortalTypeList', 'expected_portal_type_dumped_configuration'),
('ERP5Site_dumpPortalTypeRoleList', 'expected_role_dumped_configuration'),
('ERP5Site_dumpPortalSkinsContent', 'expected_portal_skins_dumped_configuration'),
('ERP5Site_dumpPropertySheetList', 'expected_property_sheet_dumped_configuration'),
('ERP5Site_dumpRuleTesterList', 'expected_rule_dumped_configuration'),
('ERP5Site_dumpSkinProperty', 'expected_skin_property_dumped_configuration'),
('ERP5Site_dumpWorkflowChain', 'expected_workflow_dumped_configuration'),
]:
ZopeTestCase._print('\n')
try:
location = self.write('%s.txt' % dump, getattr(self.portal, dump)())
location = self.write('%s' % filename, getattr(self.portal, dump)())
except Exception:
ZopeTestCase._print('Problem with %s\n' % dump)
issue_count += 1
else:
ZopeTestCase._print('Stored dump %s in %s\n' % (dump, location))
self.assertEqual(0, issue_count)
self.assertEqual(0, issue_count)
\ No newline at end of file
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