Commit f35bd9cb authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting: testSlapOSAccountingSkins update to latest changes

parent d779899b
...@@ -72,6 +72,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin): ...@@ -72,6 +72,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
destination_reference=new_destination_reference, destination_reference=new_destination_reference,
destination_section=destination_section, destination_section=destination_section,
payment_mode=payment_mode, payment_mode=payment_mode,
ledger='automated',
specialise="sale_trade_condition_module/slapos_aggregated_trade_condition", specialise="sale_trade_condition_module/slapos_aggregated_trade_condition",
created_by_builder=1 # to prevent init script to create lines created_by_builder=1 # to prevent init script to create lines
) )
...@@ -130,31 +131,6 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin): ...@@ -130,31 +131,6 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
date = item.HostingSubscription_calculateSubscriptionStartDate() date = item.HostingSubscription_calculateSubscriptionStartDate()
self.assertEqual(date, DateTime('2012/11/30')) self.assertEqual(date, DateTime('2012/11/30'))
@withAbort
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')
item.workflow_history['instance_slap_interface_workflow'] = []
item.workflow_history['instance_slap_interface_workflow'].append({
'comment':'Directly destroy',
'error_message': '',
'actor': 'ERP5TypeTestCase',
'slap_state': 'destroy_requested',
'time': destroy_date,
'action': 'request_destroy'
})
item.workflow_history['instance_slap_interface_workflow'].append({
'comment':'Directly request the instance',
'error_message': '',
'actor': 'ERP5TypeTestCase',
'slap_state': 'draft',
'time': request_date,
'action': 'request_instance'
})
date = item.InstanceTree_calculateSubscriptionStartDate()
self.assertEqual(date, DateTime('2012/10/30'))
@withAbort @withAbort
def test_HS_calculateSubscriptionStopDate_REQUEST_disallowed(self): def test_HS_calculateSubscriptionStopDate_REQUEST_disallowed(self):
item = self.createInstanceTree() item = self.createInstanceTree()
...@@ -303,23 +279,9 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin): ...@@ -303,23 +279,9 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
sale_invoice_transaction.SaleInvoiceTransaction_resetPaymentMode, sale_invoice_transaction.SaleInvoiceTransaction_resetPaymentMode,
REQUEST={}) 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())
def test_AccountingTransactionModule_getUnpaidInvoiceList(self): def test_AccountingTransactionModule_getUnpaidInvoiceList(self):
person = self.makePerson(user=1) project = self.addProject()
person = self.makePerson(project, user=1)
template = self.portal.restrictedTraverse( template = self.portal.restrictedTraverse(
self.portal.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate()) self.portal.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate())
...@@ -461,6 +423,16 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin): ...@@ -461,6 +423,16 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
invoice.SaleInvoiceTransaction_createReversalSaleInvoiceTransaction, invoice.SaleInvoiceTransaction_createReversalSaleInvoiceTransaction,
batch_mode=1) batch_mode=1)
@withAbort
def test_createReversalSaleInvoiceTransaction_wrong_ledger(self, payment_mode='payzen'):
invoice = self.createSaleInvoiceTransactionForReversal(payment_mode=payment_mode)
invoice.edit(ledger=None)
self.tic()
self.assertRaises(
AssertionError,
invoice.SaleInvoiceTransaction_createReversalSaleInvoiceTransaction,
batch_mode=1)
@withAbort @withAbort
def test_createReversalSaleInvoiceTransaction_paid(self, payment_mode='payzen'): def test_createReversalSaleInvoiceTransaction_paid(self, payment_mode='payzen'):
invoice = self.createSaleInvoiceTransactionForReversal(payment_mode=payment_mode) invoice = self.createSaleInvoiceTransactionForReversal(payment_mode=payment_mode)
...@@ -622,6 +594,10 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin): ...@@ -622,6 +594,10 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
def test_createReversalSaleInvoiceTransaction_wechat_wrong_trade_condition(self): def test_createReversalSaleInvoiceTransaction_wechat_wrong_trade_condition(self):
self.test_createReversalSaleInvoiceTransaction_wrong_trade_condition(payment_mode='wechat') self.test_createReversalSaleInvoiceTransaction_wrong_trade_condition(payment_mode='wechat')
@withAbort
def test_createReversalSaleInvoiceTransaction_wechat_wrong_ledger(self):
self.test_createReversalSaleInvoiceTransaction_wrong_ledger(payment_mode='wechat')
@withAbort @withAbort
def test_createReversalSaleInvoiceTransaction_wechat_paid(self): def test_createReversalSaleInvoiceTransaction_wechat_paid(self):
self.test_createReversalSaleInvoiceTransaction_paid(payment_mode='wechat') self.test_createReversalSaleInvoiceTransaction_paid(payment_mode='wechat')
...@@ -732,30 +708,34 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin): ...@@ -732,30 +708,34 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
self.assertEqual("Pay Now", invoice.AccountingTransaction_getPaymentState()) self.assertEqual("Pay Now", invoice.AccountingTransaction_getPaymentState())
def test_AccountingTransaction_getPaymentState_payzen_paynow_payment(self): def test_AccountingTransaction_getPaymentState_payzen_paynow_payment(self):
person = self.makePerson() project = self.addProject()
person = self.makePerson(project)
invoice = self.createStoppedSaleInvoiceTransaction( invoice = self.createStoppedSaleInvoiceTransaction(
destination_section=person.getRelativeUrl()) destination_section_value=person)
self.tic() self.tic()
self.login(person.getUserId()) self.login(person.getUserId())
self.assertEqual("Pay Now", invoice.AccountingTransaction_getPaymentState()) self.assertEqual("Pay Now", invoice.AccountingTransaction_getPaymentState())
def test_AccountingTransaction_getPaymentState_wechat_paynow_payment(self): def test_AccountingTransaction_getPaymentState_wechat_paynow_payment(self):
person = self.makePerson() project = self.addProject()
person = self.makePerson(project)
invoice = self.createStoppedSaleInvoiceTransaction( invoice = self.createStoppedSaleInvoiceTransaction(
destination_section=person.getRelativeUrl(), destination_section_value=person,
payment_mode="wechat") payment_mode="wechat")
self.tic() self.tic()
self.login(person.getUserId()) self.login(person.getUserId())
self.assertEqual("Pay Now", invoice.AccountingTransaction_getPaymentState()) self.assertEqual("Pay Now", invoice.AccountingTransaction_getPaymentState())
def test_AccountingTransaction_getPaymentState_payzen_waiting_payment(self): def test_AccountingTransaction_getPaymentState_payzen_waiting_payment(self):
person = self.makePerson() project = self.addProject()
person = self.makePerson(project)
invoice = self.createStoppedSaleInvoiceTransaction( invoice = self.createStoppedSaleInvoiceTransaction(
destination_section=person.getRelativeUrl()) destination_section_value=person)
payment = self.portal.accounting_module.newContent( payment = self.portal.accounting_module.newContent(
portal_type="Payment Transaction", portal_type="Payment Transaction",
payment_mode='payzen', payment_mode='payzen',
ledger='automated',
causality_value=invoice, causality_value=invoice,
destination_section=invoice.getDestinationSection(), destination_section=invoice.getDestinationSection(),
created_by_builder=1 # to prevent init script to create lines created_by_builder=1 # to prevent init script to create lines
...@@ -768,14 +748,16 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin): ...@@ -768,14 +748,16 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
invoice.AccountingTransaction_getPaymentState()) invoice.AccountingTransaction_getPaymentState())
def test_AccountingTransaction_getPaymentState_wechat_waiting_payment(self): def test_AccountingTransaction_getPaymentState_wechat_waiting_payment(self):
person = self.makePerson() project = self.addProject()
person = self.makePerson(project)
invoice = self.createStoppedSaleInvoiceTransaction( invoice = self.createStoppedSaleInvoiceTransaction(
destination_section=person.getRelativeUrl(), destination_section_value=person,
payment_mode='wechat') payment_mode='wechat')
payment = self.portal.accounting_module.newContent( payment = self.portal.accounting_module.newContent(
portal_type="Payment Transaction", portal_type="Payment Transaction",
payment_mode='wechat', payment_mode='wechat',
ledger='automated',
causality_value=invoice, causality_value=invoice,
destination_section=invoice.getDestinationSection(), destination_section=invoice.getDestinationSection(),
created_by_builder=1 # to prevent init script to create lines created_by_builder=1 # to prevent init script to create lines
......
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