Commit 7eb27fb2 authored by Jérome Perrin's avatar Jérome Perrin Committed by Aurel

trade_ui_test: test Organisation's "jump to trade condition"

parent 680887c5
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testOrganisationJumpToTradeCondition</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head><title>Test Organisation jump to trade condition</title></head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="4">
Test Organisation jump to trade condition
</td></tr>
</thead>
<tbody tal:define="init_method string:Zuite_createOrganisationAndTradeConditionsForTradeZuite;">
<!-- Setup {{{ -->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForTradeZuite/macros/init" />
<!-- }}} -->
<tal:block tal:repeat="trade_condition_portal_type python: ('Sale Trade Condition', 'Purchase Trade Condition', 'Internal Trade Condition', )">
<tr>
<td>open</td>
<td>${base_url}/organisation_module/erp5_trade_ui_test_organisation_1</td>
<td></td>
</tr>
<tr>
<td>selectAndWait</td>
<td>select_jump</td>
<td tal:content="trade_condition_portal_type"></td>
</tr>
<tr>
<td>assertPortalStatusMessage</td>
<td>Documents related to Organisation : erp5_trade_ui_test_organisation_1_title.</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//span[@class="listbox-current-page-total-number"]</td>
<td>2 records</td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>erp5_trade_ui_test_trade_condition_1</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>erp5_trade_ui_test_trade_condition_2</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/organisation_module/erp5_trade_ui_test_organisation_2</td>
<td></td>
</tr>
<tr>
<td>selectAndWait</td>
<td>select_jump</td>
<td tal:content="trade_condition_portal_type"></td>
</tr>
<tr>
<td>assertPortalStatusMessage</td>
<td><tal:block tal:replace="trade_condition_portal_type"/> related to Organisation : erp5_trade_ui_test_organisation_2_title.</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>erp5_trade_ui_test_trade_condition_1</td>
<td></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>erp5_trade_ui_test_trade_condition_2</td>
<td></td>
</tr>
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
portal = context.getPortalObject()
# Create organisations
erp5_trade_ui_test_organisation_1 = portal.organisation_module.newContent(
portal_type='Organisation',
id='erp5_trade_ui_test_organisation_1',
title='erp5_trade_ui_test_organisation_1_title',
)
erp5_trade_ui_test_organisation_2 = portal.organisation_module.newContent(
portal_type='Organisation',
id='erp5_trade_ui_test_organisation_2',
title='erp5_trade_ui_test_organisation_2_title',
)
# Create trade conditions
# for all type of trade condition, erp5_trade_ui_test_organisation_1 has 2 related supplies
# and erp5_trade_ui_test_organisation_2 has 1
for trade_condition_portal_type in (
'Purchase Trade Condition',
'Sale Trade Condition',
'Internal Trade Condition', ):
module = portal.getDefaultModule(trade_condition_portal_type)
module.newContent(
portal_type=trade_condition_portal_type,
id='erp5_trade_ui_test_trade_condition_1',
source_value=erp5_trade_ui_test_organisation_1,
destination_value=erp5_trade_ui_test_organisation_2,
)
module.newContent(
portal_type=trade_condition_portal_type,
id='erp5_trade_ui_test_trade_condition_2',
source_section_value=erp5_trade_ui_test_organisation_1,
)
# an unrelated trade_condition that should not be displayed
module.newContent(
portal_type=trade_condition_portal_type,
id='erp5_trade_ui_test_trade_condition_3',
)
return "Data Created."
<?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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_createOrganisationAndTradeConditionsForTradeZuite</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = context.getPortalObject()
object_value_list = [
getattr(context.sale_order_module, 'erp5_trade_ui_test_sale_order_1', None)
getattr(portal.sale_order_module, 'erp5_trade_ui_test_sale_order_1', None),
getattr(portal.organisation_module, 'erp5_trade_ui_test_organisation_1', None),
getattr(portal.organisation_module, 'erp5_trade_ui_test_organisation_2', None),
] + [
getattr(portal.getDefaultModule(portal_type), "erp5_trade_ui_test_trade_condition", None)
getattr(portal.getDefaultModule(portal_type), "erp5_trade_ui_test_trade_condition" + suffix, None)
for portal_type in ("Internal Trade Condition", "Purchase Trade Condition", "Sale Trade Condition")
for suffix in ('', '_1', '_2', '_3')
]
for object_value in object_value_list:
......
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