Commit c0bcba1e authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_accounting&erp5: Test Person_[set|get]AggregatedDelivery

parent 1a2b1504
# -*- coding: utf-8 -*-
# -*- coding: utf8 -*-
##############################################################################
#
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin, withAbort, simulate
from zExceptions import Unauthorized
......@@ -29,7 +51,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
)
@withAbort
def test_HS_calculateSubscriptionStartDate_REQUEST_disallowed(self):
def test_IT_calculateSubscriptionStartDate_REQUEST_disallowed(self):
item = self.createInstanceTree()
self.assertRaises(
Unauthorized,
......@@ -37,14 +59,14 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
REQUEST={})
@withAbort
def test_HS_calculateSubscriptionStartDate_noWorkflow(self):
def test_IT_calculateSubscriptionStartDate_noWorkflow(self):
item = self.createInstanceTree()
item.workflow_history['instance_slap_interface_workflow'] = []
date = item.InstanceTree_calculateSubscriptionStartDate()
self.assertEqual(date, item.getCreationDate().earliestTime())
@withAbort
def test_HS_calculateSubscriptionStartDate_withRequest(self):
def test_IT_calculateSubscriptionStartDate_withRequest(self):
item = self.createInstanceTree()
item.workflow_history['instance_slap_interface_workflow'] = [{
'comment':'Directly request the instance',
......@@ -58,7 +80,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
self.assertEqual(date, DateTime('2012/11/15'))
@withAbort
def test_HS_calculateSubscriptionStartDate_withRequestEndOfMonth(self):
def test_IT_calculateSubscriptionStartDate_withRequestEndOfMonth(self):
item = self.createInstanceTree()
item.workflow_history['instance_slap_interface_workflow'] = [{
'comment':'Directly request the instance',
......@@ -72,7 +94,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
self.assertEqual(date, DateTime('2012/11/30'))
@withAbort
def test_HS_calculateSubscriptionStartDate_withRequestAfterDestroy(self):
def test_IT_calculateSubscriptionStartDate_withRequestAfterDestroy(self):
item = self.createInstanceTree()
destroy_date = DateTime('2012/10/30 11:11')
request_date = DateTime('2012/11/30 11:11')
......@@ -97,7 +119,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
self.assertEqual(date, DateTime('2012/10/30'))
@withAbort
def test_HS_calculateSubscriptionStopDate_REQUEST_disallowed(self):
def test_IT_calculateSubscriptionStopDate_REQUEST_disallowed(self):
item = self.createInstanceTree()
self.assertRaises(
Unauthorized,
......@@ -105,7 +127,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
REQUEST={})
@withAbort
def test_HS_calculateSubscriptionStopDate_withDestroy(self):
def test_IT_calculateSubscriptionStopDate_withDestroy(self):
item = self.createInstanceTree()
destroy_date = DateTime('2012/10/30')
item.workflow_history['instance_slap_interface_workflow'].append({
......@@ -120,7 +142,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
self.assertEqual(date, DateTime('2012/10/31'))
@withAbort
def test_HS_calculateSubscriptionStopDate_noDestroy(self):
def test_IT_calculateSubscriptionStopDate_noDestroy(self):
item = self.createInstanceTree()
item.workflow_history['instance_slap_interface_workflow'] = []
date = item.InstanceTree_calculateSubscriptionStopDate()
......@@ -248,4 +270,19 @@ return context.getParentValue()""")
self.assertRaises(
Unauthorized,
sale_invoice_transaction.SaleInvoiceTransaction_resetPaymentMode,
REQUEST={})
\ No newline at end of file
REQUEST={})
def test_Person_get_set_AggregatedDelivery(self):
person = self.makePerson()
self.assertEqual(
person.Person_getAggregatedDelivery(), None)
delivery = self.portal.sale_packing_list_module.newContent(
portal_type="Sale Packing List")
person.Person_setAggregatedDelivery(delivery)
self.assertEqual(delivery,
person.Person_getAggregatedDelivery())
......@@ -6,12 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testSlapOSAccountingSkins</string> </value>
......@@ -55,28 +49,13 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</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>
......@@ -89,7 +68,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -98,7 +77,7 @@
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -174,8 +174,6 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template):
'slapos_accounting/OrderBuilder_selectSlapOSAggregatedDeliveryList',
'slapos_accounting/PaymentTransaction_getExternalPaymentId',
'slapos_accounting/PaymentTransaction_postOrderBuild',
'slapos_accounting/Person_getAggregatedDelivery',
'slapos_accounting/Person_setAggregatedDelivery',
'slapos_accounting/SaleInvoiceTransaction_init',
'slapos_accounting/SaleInvoiceTransaction_isTotalPriceEqualAccounting',
'slapos_accounting/SaleInvoiceTransaction_isTotalPriceMatchingSalePackingList',
......
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