Commit ee076aa4 authored by Łukasz Nowak's avatar Łukasz Nowak

Test API with simulator.

parent d5c21457
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Computer" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>allocation_scope/open/personal</string>
<string>source_administration/person_module/test_vifib_customer</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_destination_reference</string> </key>
<value> <string>01</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>COMP-2</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_vifib_slapos_rest_api_v1_computer</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Computer</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>test server</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Computer Partition" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>part0</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>1</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Computer Partition</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Hosting Subscription" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Author</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Author</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Author</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Author</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Author</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>explanation</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>predecessor/software_instance_module/test_vifib_slapos_rest_api_v1_software_instance</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>HOSTSUBS-0</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>RootSoftwareInstance</string> </value>
</item>
<item>
<key> <string>explanation</string> </key>
<value> <string>Set up because of /erp5/sale_packing_list_module/1/1</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_vifib_slapos_rest_api_v1_hosting_subscription</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple>
<int>19</int>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Hosting Subscription</string> </value>
</item>
<item>
<key> <string>root_slave</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>root_software_release_url</string> </key>
<value> <string>http://example.com/buildout.cfg</string> </value>
</item>
<item>
<key> <string>root_state</string> </key>
<value> <string>started</string> </value>
</item>
<item>
<key> <string>sla_xml</string> </key>
<value> <string encoding="cdata"><![CDATA[
<?xml version=\'1.0\' encoding=\'utf-8\'?>\n
<instance>\n
<parameter id="computer_guid">COMP-2</parameter>\n
</instance>
]]></string> </value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
<?xml version="1.0" encoding="utf-8"?>\n
<instance>\n
<parameter id="nbd_ip">2a01:e35:2e27:460:e2cb:4eff:fed9:48dc</parameter>\n
<parameter id="nbd_port">1024</parameter>\n
</instance>
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>test instance</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Internal Packing List" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>destination_section/person_module/test_vifib_customer</string>
<string>source_administration/person_module/test_vifib_customer</string>
<string>destination/person_module/test_vifib_customer</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>IPL-1</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_vifib_slapos_rest_api_v1_internal_packing_list</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Internal Packing List</string> </value>
</item>
<item>
<key> <string>start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1334845509.33</float>
<string>GMT+2</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Internal Packing List Line" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>quantity_unit/unit/piece</string>
<string>base_contribution/base_amount/invoicing/discounted</string>
<string>base_contribution/base_amount/invoicing/taxable</string>
<string>use/trade/sale</string>
<string>aggregate/computer_module/test_vifib_slapos_rest_api_v1_computer</string>
<string>resource/service_module/computer_registration</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>1</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>1</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Internal Packing List Line</string> </value>
</item>
<item>
<key> <string>quantity</string> </key>
<value> <float>1.0</float> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Sale Order" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>quantity_unit</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>price_currency/currency_module/EUR</string>
<string>source_section/organisation_module/vifib_internet</string>
<string>destination/person_module/test_vifib_customer</string>
<string>destination_decision/person_module/test_vifib_customer</string>
<string>specialise/sale_trade_condition_module/vifib_trade_condition</string>
<string>source/organisation_module/vifib_internet</string>
<string>destination_section/person_module/test_vifib_customer</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>SO-1</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_vifib_slapos_rest_api_v1_sale_order</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Sale Order</string> </value>
</item>
<item>
<key> <string>quantity_unit</string> </key>
<value> <string>unit/piece</string> </value>
</item>
<item>
<key> <string>received_date</string> </key>
<value>
<object>
<klass>
<global id="1.1" name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1334845683.4</float>
<string>GMT+2</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>start_date</string> </key>
<value>
<object>
<klass> <reference id="1.1"/> </klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1334846134.66</float>
<string>GMT+2</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Sale Order Line" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>resource/service_module/vifib_instance_setup</string>
<string>quantity_unit/unit/piece</string>
<string>use/trade/sale</string>
<string>base_contribution/base_amount/invoicing/discounted</string>
<string>base_contribution/base_amount/invoicing/taxable</string>
<string>aggregate/software_instance_module/test_vifib_slapos_rest_api_v1_software_instance</string>
<string>aggregate/hosting_subscription_module/test_vifib_slapos_rest_api_v1_hosting_subscription</string>
<string>aggregate/software_release_module/test_software_release</string>
<string>aggregate/computer_module/test_vifib_slapos_rest_api_v1_computer/1</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>1</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>1</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Sale Order Line</string> </value>
</item>
<item>
<key> <string>price</string> </key>
<value> <float>0.0</float> </value>
</item>
<item>
<key> <string>quantity</string> </key>
<value> <float>1.0</float> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Sale Packing List" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>source/organisation_module/vifib_internet</string>
<string>causality/sale_order_module/test_vifib_slapos_rest_api_v1_sale_order</string>
<string>source_section/organisation_module/vifib_internet</string>
<string>destination/person_module/test_vifib_customer</string>
<string>price_currency/currency_module/EUR</string>
<string>specialise/sale_trade_condition_module/vifib_trade_condition</string>
<string>destination_section/person_module/test_vifib_customer</string>
<string>destination_decision/person_module/test_vifib_customer</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>SPL-1</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_vifib_slapos_rest_api_v1_instance_setup_sale_packing_list</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Sale Packing List</string> </value>
</item>
<item>
<key> <string>start_date</string> </key>
<value>
<object id="1.1">
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1334846134.66</float>
<string>GMT+2</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>stop_date</string> </key>
<value> <reference id="1.1"/> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>SO-1</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Sale Packing List Line" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>resource/service_module/vifib_instance_setup</string>
<string>use/trade/sale</string>
<string>quantity_unit/unit/piece</string>
<string>aggregate/computer_module/test_vifib_slapos_rest_api_v1_computer/1</string>
<string>aggregate/hosting_subscription_module/test_vifib_slapos_rest_api_v1_hosting_subscription</string>
<string>aggregate/software_instance_module/test_vifib_slapos_rest_api_v1_software_instance</string>
<string>aggregate/software_release_module/test_software_release</string>
<string>base_contribution/base_amount/invoicing/discounted</string>
<string>base_contribution/base_amount/invoicing/taxable</string>
<string>causality/sale_order_module/test_vifib_slapos_rest_api_v1_sale_order/1</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>1</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>1</string> </value>
</item>
<item>
<key> <string>index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Sale Packing List Line</string> </value>
</item>
<item>
<key> <string>price</string> </key>
<value> <float>0.0</float> </value>
</item>
<item>
<key> <string>quantity</string> </key>
<value> <float>1.0</float> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>movement</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Sale Trade Condition" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>destination_section/person_module/test_vifib_customer</string>
<string>source_section/person_module/test_vifib_customer</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>STC_1</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_vifib_slapos_rest_api_v1_sale_trade_condition</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Sale Trade Condition</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>test server (COMP-2) supply condition</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="6" aka="AAAAAAAAAAY=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Sale Supply Line" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>aggregate/computer_module/test_vifib_slapos_rest_api_v1_computer</string>
<string>resource/service_module/vifib_instance_setup</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>1</string> </value>
</item>
<item>
<key> <string>mapped_value_property_list</string> </key>
<value>
<tuple>
<string>base_price</string>
<string>additional_price</string>
<string>discount_ratio</string>
<string>exclusive_discount_ratio</string>
<string>surcharge_ratio</string>
<string>variable_additional_price</string>
<string>non_discountable_additional_price</string>
<string>priced_quantity</string>
<string>base_unit_price</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Sale Supply Line</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Software Instance" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_destination_reference</string> </key>
<value> <string>02</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>SOFTINST-0</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>RootSoftwareInstance</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_vifib_slapos_rest_api_v1_software_instance</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Software Instance</string> </value>
</item>
<item>
<key> <string>sla_xml</string> </key>
<value> <string encoding="cdata"><![CDATA[
<?xml version=\'1.0\' encoding=\'utf-8\'?>\n
<instance>\n
<parameter id="computer_guid">COMP-2</parameter>\n
</instance>
]]></string> </value>
</item>
<item>
<key> <string>ssl_certificate</string> </key>
<value> <string>Certificate:\n
Data:\n
Version: 3 (0x2)\n
Serial Number: 2 (0x2)\n
Signature Algorithm: sha1WithRSAEncryption\n
Issuer: C=PL, ST=Silesia, L=Bytom, O=Luke Ltd, CN=Certificate Authority bdbe24bc-889b-11e1-973b-00215dc2e59c/emailAddress=luke@nexedi.com\n
Validity\n
Not Before: Apr 19 14:28:02 2012 GMT\n
Not After : Apr 17 14:28:02 2022 GMT\n
Subject: C=PL, ST=Silesia, O=Luke Ltd, CN=SOFTINST-0/emailAddress=luke@nexedi.com\n
Subject Public Key Info:\n
Public Key Algorithm: rsaEncryption\n
Public-Key: (2048 bit)\n
Modulus:\n
00:b8:98:81:1c:ba:85:f3:d0:a6:bd:83:06:5a:06:\n
4a:b6:1e:ed:32:44:81:9e:97:b9:33:0a:e1:cd:7c:\n
02:f8:1e:c5:56:8e:e6:75:c5:a2:44:a8:60:3d:f1:\n
be:b4:c5:91:00:21:a4:89:a7:00:c3:9f:3d:49:1e:\n
ed:be:37:3b:06:95:56:2f:2f:0a:7f:80:e8:69:13:\n
57:51:54:6e:c6:16:bf:3d:74:3a:84:68:10:ec:be:\n
bc:60:5a:d9:07:dd:00:0a:55:78:d9:6d:42:12:c3:\n
ba:93:f4:8f:16:29:00:21:4c:86:cc:40:0f:61:ad:\n
27:aa:42:8a:ff:59:94:21:c0:d1:25:dc:99:c6:20:\n
3b:43:e0:60:0c:e7:86:e1:18:bc:44:eb:12:77:5f:\n
f8:a7:57:61:e4:63:63:f8:20:48:6e:3b:64:c9:97:\n
ab:4b:ea:3a:e8:96:e9:ff:98:36:aa:d8:c6:77:c5:\n
eb:48:24:05:a9:b0:45:34:ea:81:57:df:64:29:a0:\n
fa:0e:5c:d2:ff:47:5a:90:63:a6:3d:27:19:31:88:\n
07:0e:d0:17:ae:17:1a:c8:fc:e8:75:ca:17:24:33:\n
99:4d:51:c2:6b:26:69:35:94:88:97:3c:68:d1:b5:\n
6b:84:75:55:fa:0c:15:d1:8a:80:d1:7e:aa:0a:4e:\n
4e:e7\n
Exponent: 65537 (0x10001)\n
X509v3 extensions:\n
X509v3 Basic Constraints: \n
CA:FALSE\n
Netscape Comment: \n
OpenSSL Generated Certificate\n
X509v3 Subject Key Identifier: \n
DE:9F:89:65:E1:7C:A3:88:A1:EE:79:A4:81:A8:97:C5:F5:E5:6B:DA\n
X509v3 Authority Key Identifier: \n
keyid:98:C1:BA:FC:AE:0A:0E:B1:0D:80:79:95:1A:7B:BE:6E:F4:DE:31:9E\n
\n
Signature Algorithm: sha1WithRSAEncryption\n
73:b2:c7:a9:e2:75:b7:69:a7:11:1b:8b:8a:eb:1f:bd:37:a8:\n
73:d0:67:00:d9:54:ca:c3:82:f5:f4:e1:6f:0d:ad:2c:50:b2:\n
ec:74:ae:c1:87:bc:33:4e:8e:e7:56:be:1c:77:7f:7c:2d:90:\n
19:54:ed:ac:a7:99:cb:01:4c:df:ca:c7:9f:56:32:3e:7a:98:\n
fe:bf:73:fc:12:d3:33:dc:f4:10:16:0a:1f:c4:10:33:e0:14:\n
0a:2f:dd:7a:5d:34:ec:1a:b0:68:d1:ec:91:cb:9a:c6:b7:8a:\n
04:b8:69:50:b0:ef:34:2a:62:af:95:43:86:5b:6c:92:65:25:\n
e5:6d:0c:95:f3:f7:19:0f:33:71:12:80:fe:21:da:f1:8a:24:\n
bb:ae:75:3d:af:b6:22:f4:01:26:31:23:1f:a9:8d:6a:7c:a8:\n
1a:81:7b:38:12:e1:95:62:3c:22:f1:66:81:8e:88:6b:a6:e0:\n
0e:9a:54:69:08:96:ad:42:d4:43:0c:8a:48:7b:fc:72:9c:b8:\n
7c:f9:7b:6f:55:35:86:66:26:92:2c:5f:8d:0a:85:94:87:c4:\n
41:cb:b7:35:52:80:a6:5a:f4:0d:a8:93:bc:88:41:29:d5:cf:\n
af:bd:f2:e5:28:a1:cb:d6:d2:aa:c3:e4:0e:0b:11:e9:85:ea:\n
7b:2d:7b:14\n
-----BEGIN CERTIFICATE-----\n
MIIEBTCCAu2gAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBpzELMAkGA1UEBhMCUEwx\n
EDAOBgNVBAgMB1NpbGVzaWExDjAMBgNVBAcMBUJ5dG9tMREwDwYDVQQKDAhMdWtl\n
IEx0ZDFDMEEGA1UEAww6Q2VydGlmaWNhdGUgQXV0aG9yaXR5IGJkYmUyNGJjLTg4\n
OWItMTFlMS05NzNiLTAwMjE1ZGMyZTU5YzEeMBwGCSqGSIb3DQEJARYPbHVrZUBu\n
ZXhlZGkuY29tMB4XDTEyMDQxOTE0MjgwMloXDTIyMDQxNzE0MjgwMlowZzELMAkG\n
A1UEBhMCUEwxEDAOBgNVBAgMB1NpbGVzaWExETAPBgNVBAoMCEx1a2UgTHRkMRMw\n
EQYDVQQDDApTT0ZUSU5TVC0wMR4wHAYJKoZIhvcNAQkBFg9sdWtlQG5leGVkaS5j\n
b20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC4mIEcuoXz0Ka9gwZa\n
Bkq2Hu0yRIGel7kzCuHNfAL4HsVWjuZ1xaJEqGA98b60xZEAIaSJpwDDnz1JHu2+\n
NzsGlVYvLwp/gOhpE1dRVG7GFr89dDqEaBDsvrxgWtkH3QAKVXjZbUISw7qT9I8W\n
KQAhTIbMQA9hrSeqQor/WZQhwNEl3JnGIDtD4GAM54bhGLxE6xJ3X/inV2HkY2P4\n
IEhuO2TJl6tL6jrolun/mDaq2MZ3xetIJAWpsEU06oFX32QpoPoOXNL/R1qQY6Y9\n
JxkxiAcO0BeuFxrI/Oh1yhckM5lNUcJrJmk1lIiXPGjRtWuEdVX6DBXRioDRfqoK\n
Tk7nAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wg\n
R2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBTen4ll4XyjiKHueaSBqJfF\n
9eVr2jAfBgNVHSMEGDAWgBSYwbr8rgoOsQ2AeZUae75u9N4xnjANBgkqhkiG9w0B\n
AQUFAAOCAQEAc7LHqeJ1t2mnERuLiusfvTeoc9BnANlUysOC9fThbw2tLFCy7HSu\n
wYe8M06O51a+HHd/fC2QGVTtrKeZywFM38rHn1YyPnqY/r9z/BLTM9z0EBYKH8QQ\n
M+AUCi/del007BqwaNHskcuaxreKBLhpULDvNCpir5VDhltskmUl5W0MlfP3GQ8z\n
cRKA/iHa8Yoku651Pa+2IvQBJjEjH6mNanyoGoF7OBLhlWI8IvFmgY6Ia6bgDppU\n
aQiWrULUQwyKSHv8cpy4fPl7b1U1hmYmkixfjQqFlIfEQcu3NVKAplr0DaiTvIhB\n
KdXPr73y5Sihy9bSqsPkDgsR6YXqey17FA==\n
-----END CERTIFICATE-----\n
</string> </value>
</item>
<item>
<key> <string>ssl_key</string> </key>
<value> <string>-----BEGIN PRIVATE KEY-----\n
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC4mIEcuoXz0Ka9\n
gwZaBkq2Hu0yRIGel7kzCuHNfAL4HsVWjuZ1xaJEqGA98b60xZEAIaSJpwDDnz1J\n
Hu2+NzsGlVYvLwp/gOhpE1dRVG7GFr89dDqEaBDsvrxgWtkH3QAKVXjZbUISw7qT\n
9I8WKQAhTIbMQA9hrSeqQor/WZQhwNEl3JnGIDtD4GAM54bhGLxE6xJ3X/inV2Hk\n
Y2P4IEhuO2TJl6tL6jrolun/mDaq2MZ3xetIJAWpsEU06oFX32QpoPoOXNL/R1qQ\n
Y6Y9JxkxiAcO0BeuFxrI/Oh1yhckM5lNUcJrJmk1lIiXPGjRtWuEdVX6DBXRioDR\n
fqoKTk7nAgMBAAECggEAMh9et3FCHADktYKVP+6DbM4a89I8K9bgt6ZVx5jLqZmZ\n
VbZ5hzMBq4jYkRlKAgW/KHz6E1JgV72uQ2N9hG+0vEXiX+9y90oGUTmqNPArH+hf\n
Rw1/MiKbrdzgg31HfuYYM7YfmVIcZcH1sGTwUUESwvfnhiBCzO/aXFWzLkChg0RE\n
l3Nk732x5EhY1TdwzWP74QMFOfSfg63LC0+nJByxOYyBZorV16v1VRqGzghRTeGP\n
v/OpsvhMYXm7kh0kfq7qbXpaeWPnWS06qWM1ekBmdYSgzw4wShgeUrOeb23VmjOW\n
I8ICPcl4jlrO2tVK1aHupcTZCAvl8SW+0c4jB1qk8QKBgQDjwT/Qz8WKhRw25wlx\n
I1vJMR1WeoF2FBESojLY3ZZPr035KOM8PjIPPLcjQIvOdOsHhrlvdiI0FYj+3I6q\n
jB8X3Lq6xBEw7F5516+xVxsfxEE8itMJXK6QNMaeOO2mrnJv6j6Ss6SXQRliqJlO\n
AQTKeghYWmLlKERpPzPmkGXy2QKBgQDPfQpJQkZbfmKbb+TusycsHj/XVgWTasJS\n
SuIW9DeFMYfbBLLunzVjBy87XbXpyHeR1XqoPEM6ICDQlUJS5IDwsttJJfrF1iJ3\n
scGgFg4JIzruqG2t8RLLXKsWpgxQz2Qxqx5DgCdXXAbVdjHkJjQ+PdWb6kDvN+bX\n
qR+UOa23vwKBgQDaoehgyxMWpjEvgxnNQeQafstq+K7OavT4rjuhcxWX6PEw/c8l\n
RY9IkUA81vled14nG21nUkADP6kC/zb1AQ3YGkwmfZEDJeSLkkFWPAgNtpfpRlrP\n
4eixBfikaoG4QD4asQLgURLvH87+plqERvYSaJMaPaox0TXa0pFAA93aAQKBgC6o\n
LnT0yz9ttxy+15r5fDiGgNKaTFyu6A17O0XwGr//uE3+y4GvGWEwT2WpF+v/ISwQ\n
9ij4jCF48ggVWDmtmnUFsxvKx45PLab+uMyXyQYy/uCFzUwM5q4GI47PPfu59wzY\n
LtD881vInNzJXESydpL8cplB3uIsDuO16xz4r2CfAoGBAM57WPeUCBoGUzDXKPR/\n
XDcGie2q0bRdlCAUMdCucO2A6Nh3WkDu+ZEMW/JwpwYJGTIZ/kN9158Gn4qPYRtg\n
ZtyrVc7LkDpSHECXGMnvVN8pHoF8bKUS6r1yCvq9Ta+JM7S1M1hwTCkKPACLa7hC\n
wEsr7FKBunKvatC4k/gNd6dc\n
-----END PRIVATE KEY-----\n
</string> </value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
<?xml version="1.0" encoding="utf-8"?>\n
<instance>\n
<parameter id="nbd_ip">2a01:e35:2e27:460:e2cb:4eff:fed9:48dc</parameter>\n
<parameter id="nbd_port">1024</parameter>\n
</instance>
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>test instance</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -2,29 +2,19 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase ...@@ -2,29 +2,19 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
import transaction import transaction
import httplib import httplib
import urlparse import urlparse
from ZODB.POSException import ConflictError import json
import tempfile
import os
class TestVifibSlaposRestAPIV1(ERP5TypeTestCase): class Person_requestSoftwareInstanceSimulator:
def getWorkflowTransitionAmount(self, document, transition_id): def __init__(self, outfile):
amount = 0 self.outfile = outfile
workflow_id_list = [workflow_id for workflow_id, workflow_state in \
document.getWorkflowStateItemList()] def __call__(self, *args, **kwargs):
for wf_id in workflow_id_list: """Simulation Method"""
list_history_item = None open(self.outfile, 'a').write('recargs = %r\nreckwargs = %r' % (args, kwargs))
try:
list_history_item = self.portal.portal_workflow.getInfoFor(
ob=document, name='history', wf_id=wf_id)
except ConflictError:
raise
except Exception:
pass
if list_history_item in (None, ()):
continue
for wf_dict in list_history_item:
if wf_dict.get('action', '') == transition_id:
amount += 1
return amount
class TestVifibSlaposRestAPIV1(ERP5TypeTestCase):
def generateNewId(self): def generateNewId(self):
return str(self.getPortalObject().portal_ids.generateNewId( return str(self.getPortalObject().portal_ids.generateNewId(
id_group=('slapos_rest_api_v1_test'))) id_group=('slapos_rest_api_v1_test')))
...@@ -43,6 +33,9 @@ class TestVifibSlaposRestAPIV1(ERP5TypeTestCase): ...@@ -43,6 +33,9 @@ class TestVifibSlaposRestAPIV1(ERP5TypeTestCase):
transaction.commit() transaction.commit()
def afterSetUp(self): def afterSetUp(self):
self.test_random_id = self.generateNewId()
self.document_list = []
self.portal = self.getPortalObject()
self.customer = self.cloneByPath('person_module/template_member') self.customer = self.cloneByPath('person_module/template_member')
self.customer_reference = 'P' + self.test_random_id self.customer_reference = 'P' + self.test_random_id
self.customer.edit( self.customer.edit(
...@@ -52,14 +45,20 @@ class TestVifibSlaposRestAPIV1(ERP5TypeTestCase): ...@@ -52,14 +45,20 @@ class TestVifibSlaposRestAPIV1(ERP5TypeTestCase):
for assignment in self.customer.contentValues(portal_type='Assignment'): for assignment in self.customer.contentValues(portal_type='Assignment'):
assignment.open() assignment.open()
self.test_random_id = self.generateNewId()
self.document_list = []
self.portal = self.getPortalObject()
self.api_url = self.portal.portal_vifib_rest_api_v1.absolute_url() self.api_url = self.portal.portal_vifib_rest_api_v1.absolute_url()
self.api_scheme, self.api_netloc, self.api_path, self.api_query, \ self.api_scheme, self.api_netloc, self.api_path, self.api_query, \
self.api_fragment = urlparse.urlsplit(self.api_url) self.api_fragment = urlparse.urlsplit(self.api_url)
self.connection = httplib.HTTPConnection(self.api_netloc)
self.reindexAndUpdateLocalRoles() self.reindexAndUpdateLocalRoles()
self.simulator = tempfile.mkstemp()[1]
self.customer.requestSoftwareInstance = Person_requestSoftwareInstanceSimulator(
self.simulator)
transaction.commit()
def beforeTearDown(self):
if os.path.exists(self.simulator):
os.unlink(self.simulator)
def cloneByPath(self, path): def cloneByPath(self, path):
o = self.portal.restrictedTraverse(path).Base_createCloneDocument( o = self.portal.restrictedTraverse(path).Base_createCloneDocument(
...@@ -67,135 +66,153 @@ class TestVifibSlaposRestAPIV1(ERP5TypeTestCase): ...@@ -67,135 +66,153 @@ class TestVifibSlaposRestAPIV1(ERP5TypeTestCase):
self.document_list.append(o) self.document_list.append(o)
return o return o
def createStartedInstance(self): def prepareResponse(self):
self.computer = self.cloneByPath( self.response = self.connection.getresponse()
'computer_module/test_vifib_slapos_rest_api_v1_computer') self.response_data = self.response.read()
self.computer.edit(
reference='C' + self.test_random_id,
source_administration=self.customer.getRelativeUrl()
)
self.computer.validate()
for p in self.computer.contentValues(portal_type='Computer Partition'):
self.computer_partition = p
p.validate()
p.markFree()
self.supply = self.cloneByPath(
'sale_trade_condition_module/test_vifib_slapos_rest_api_v1_sale_trade_condition')
self.supply.edit(
destination_section=self.customer.getRelativeUrl(),
source_section=self.customer.getRelativeUrl()
)
self.supply.validate()
supply_line = self.supply.contentValues()[0]
supply_line.edit(aggregate=self.computer.getRelativeUrl())
self.internal_delivery = self.cloneByPath(
'internal_packing_list_module/test_vifib_slapos_rest_api_v1_internal_packing_list')
self.internal_delivery.edit(
destination_section=self.customer.getRelativeUrl(),
source_administration=self.customer.getRelativeUrl(),
destination=self.customer.getRelativeUrl(),
)
internal_line = self.internal_delivery.contentValues()[0]
internal_line.edit(aggregate=self.computer.getRelativeUrl())
self.internal_delivery.confirm()
self.internal_delivery.stop()
self.internal_delivery.deliver()
self.software_release = self.cloneByPath(
'software_release_module/test_software_release')
self.software_release.edit(url_string=self.test_random_id,
reference=self.test_random_id)
self.software_release.publish()
self.instance_title = 'T' + self.test_random_id
self.instance_reference = 'SI' + self.test_random_id
self.hosting_subscription = self.cloneByPath(
'hosting_subscription_module/test_vifib_slapos_rest_api_v1_hosting_subscription')
self.hosting_subscription.setReference('HS' + self.test_random_id)
self.hosting_subscription.setTitle(self.instance_title)
self.hosting_subscription.validate()
self.software_instance = self.cloneByPath(
'software_instance_module/test_vifib_slapos_rest_api_v1_software_instance')
self.software_instance.edit(
reference=self.instance_reference,
title=self.instance_title
)
self.software_instance.validate()
self.software_instance.requestStartComputerPartition()
self.hosting_subscription.setPredecessor(
self.software_instance.getRelativeUrl())
self.order = self.cloneByPath(
'sale_order_module/test_vifib_slapos_rest_api_v1_sale_order')
self.order.edit(
destination_section=self.customer.getRelativeUrl(),
destination_decision=self.customer.getRelativeUrl(),
destination=self.customer.getRelativeUrl()
)
aggregate_list = [
self.software_instance.getRelativeUrl(),
self.hosting_subscription.getRelativeUrl(),
self.software_release.getRelativeUrl(),
self.computer_partition.getRelativeUrl()
]
order_line = self.order.contentValues()[0]
order_line.edit(aggregate_list=aggregate_list)
self.order.order()
self.order.confirm()
self.packing_list = self.cloneByPath(
'sale_packing_list_module/test_vifib_slapos_rest_api_v1_instance_setup_sale_packing_list')
self.packing_list.edit(
causality=self.order.getRelativeUrl(),
destination=self.customer.getRelativeUrl(),
destination_section=self.customer.getRelativeUrl(),
destination_decision=self.customer.getRelativeUrl(),
)
packing_list_line = self.packing_list.contentValues()[0]
packing_list_line.edit(aggregate_list=aggregate_list,
causality=order_line.getRelativeUrl())
self.packing_list.confirm()
self.packing_list.start()
self.packing_list.stop()
self.open_order = self.cloneByPath(
'open_sale_order_module/test_vifib_customer_open_sale_order')
self.open_order.edit(
reference='OO' + self.test_random_id,
destination_section=self.customer.getRelativeUrl(),
destination_decision=self.customer.getRelativeUrl(),
destination=self.customer.getRelativeUrl()
)
self.open_order.deleteContent(list(self.open_order.objectIds()))
self.open_order.newContent(portal_type='Open Sale Order Line',
resource='service_module/vifib_instance_subscription',
base_contribution=['base_amount/invoicing/discounted',
'base_amount/invoicing/taxable'],
use='trade/sale',
quantity_unit='unit/piece',
aggregate=self.hosting_subscription.getRelativeUrl()
)
self.open_order.order()
self.open_order.validate()
self.reindexAndUpdateLocalRoles() def assertBasicResponse(self):
self.assertEqual(self.response.getheader('access-control-allow-origin'),
'*')
self.assertEqual(self.response.getheader('access-control-allow-methods'),
'DELETE, PUT, POST, GET, OPTIONS')
def test_instance_destruction_started(self): def assertResponseCode(self, code):
transition_id = 'request_software_instance' self.assertEqual(self.response.status, code,
self.createStartedInstance()
amount = self.getWorkflowTransitionAmount(self.customer,
transition_id)
connection = httplib.HTTPConnection(self.api_netloc)
connection.request(method='DELETE',
url='/'.join([self.api_path, 'instance', self.instance_reference]),
body='', headers={'REMOTE_USER': self.customer_reference})
response = connection.getresponse()
self.assertEqual(response.status, httplib.ACCEPTED,
'%s was expected, but got %s with response:\n%s' % '%s was expected, but got %s with response:\n%s' %
(httplib.ACCEPTED, response.status, response.read())) (code, self.response.status, self.response_data))
self.assertEqual(amount+1, self.getWorkflowTransitionAmount(self.customer,
transition_id), 'Transition %s was not called' % transition_id) def assertResponseJson(self):
raise NotImplementedError( self.assertEqual(self.response.getheader('Content-Type'), 'application/json')
'Check that passed reference was used in wf transition') self.json_response = json.loads(self.response_data)
def assertSimulatorEmpty(self):
self.assertEqual(open(self.simulator).read(), '')
def assertSimulator(self, args, kwargs):
exec(open(self.simulator).read())
# do the same translation magic as in tool
kwargs = kwargs.copy()
for k_j, k_i in (
('software_release', 'software_release'),
('title', 'software_title'),
('software_type', 'software_type'),
('parameter', 'instance_xml'),
('sla', 'sla_xml'),
('slave', 'shared'),
('status', 'state')
):
kwargs[k_i] = kwargs.pop(k_j)
self.assertEqual(args, recargs)
self.assertEqual(kwargs, reckwargs)
def test_request_not_logged_in(self):
self.connection.request(method='POST',
url='/'.join([self.api_path, 'instance']))
self.prepareResponse()
self.assertBasicResponse()
self.assertResponseCode(401)
self.assertTrue(self.response.getheader('Location') is not None)
auth = self.response.getheader('WWW-Authenticate')
self.assertTrue(auth is not None)
self.assertTrue('Bearer realm="' in auth)
self.assertSimulatorEmpty()
def test_request_no_json(self):
self.connection.request(method='POST',
url='/'.join([self.api_path, 'instance']),
headers={'REMOTE_USER': self.customer_reference})
self.prepareResponse()
self.assertBasicResponse()
self.assertResponseCode(400)
self.assertResponseJson()
self.assertTrue('error' in self.json_response)
self.assertEqual("Data is not json object.", self.json_response['error'])
self.assertSimulatorEmpty()
def test_request_bad_json(self):
self.connection.request(method='POST',
url='/'.join([self.api_path, 'instance']),
body='This is not JSON',
headers={'REMOTE_USER': self.customer_reference})
self.prepareResponse()
self.assertBasicResponse()
self.assertResponseCode(400)
self.assertResponseJson()
self.assertTrue('error' in self.json_response)
self.assertEqual("Data is not json object.", self.json_response['error'])
self.assertSimulatorEmpty()
def test_request_empty_json(self):
self.connection.request(method='POST',
url='/'.join([self.api_path, 'instance']),
body='{}',
headers={'REMOTE_USER': self.customer_reference})
self.prepareResponse()
self.assertBasicResponse()
self.assertResponseCode(400)
self.assertResponseJson()
self.assertEqual({
"status": "Missing.",
"slave": "Missing.",
"title": "Missing.",
"software_release": "Missing.",
"software_type": "Missing.",
"parameter": "Missing.",
"sla": "Missing."},
self.json_response)
self.assertSimulatorEmpty()
def test_request_status_slave_missing_json(self):
self.connection.request(method='POST',
url='/'.join([self.api_path, 'instance']),
body="""
{
"title": "My unique instance",
"software_release": "http://example.com/example.cfg",
"software_type": "type_provided_by_the_software",
"parameter": {
"Custom1": "one string",
"Custom2": "one float",
"Custom3": [
"abc",
"def"
]
},
"sla": {
"computer_id": "COMP-0"
}
}""",
headers={'REMOTE_USER': self.customer_reference})
self.prepareResponse()
self.assertBasicResponse()
self.assertResponseCode(400)
self.assertResponseJson()
self.assertEqual({
"status": "Missing.",
"slave": "Missing."
},
self.json_response)
self.assertSimulatorEmpty()
def test_request_correct(self):
kwargs = {
'parameter': {
'Custom1': 'one string',
'Custom2': 'one float',
'Custom3': ['abc', 'def']},
'title': 'My unique instance',
'software_release': 'http://example.com/example.cfg',
'status': 'started',
'sla': {
'computer_id': 'COMP-0'},
'software_type': 'type_provided_by_the_software',
'slave': True}
self.connection.request(method='POST',
url='/'.join([self.api_path, 'instance']),
body=json.dumps(kwargs),
headers={'REMOTE_USER': self.customer_reference})
self.prepareResponse()
self.assertBasicResponse()
self.assertResponseCode(202)
self.assertResponseJson()
self.assertSimulator((), kwargs)
1 2
\ No newline at end of file \ No newline at end of file
computer_module/test_vifib_slapos_rest_api_v1_computer
computer_module/test_vifib_slapos_rest_api_v1_computer/**
hosting_subscription_module/test_vifib_slapos_rest_api_v1_hosting_subscription
hosting_subscription_module/test_vifib_slapos_rest_api_v1_hosting_subscription/**
internal_packing_list_module/test_vifib_slapos_rest_api_v1_internal_packing_list
internal_packing_list_module/test_vifib_slapos_rest_api_v1_internal_packing_list/**
sale_order_module/test_vifib_slapos_rest_api_v1_sale_order
sale_order_module/test_vifib_slapos_rest_api_v1_sale_order/**
sale_packing_list_module/test_vifib_slapos_rest_api_v1_instance_setup_sale_packing_list
sale_packing_list_module/test_vifib_slapos_rest_api_v1_instance_setup_sale_packing_list/**
sale_trade_condition_module/test_vifib_slapos_rest_api_v1_sale_trade_condition
sale_trade_condition_module/test_vifib_slapos_rest_api_v1_sale_trade_condition/**
software_instance_module/test_vifib_slapos_rest_api_v1_software_instance
software_instance_module/test_vifib_slapos_rest_api_v1_software_instance/**
\ 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