Commit c795be58 authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting: test: drop tests related to dropped scripts

parent b80cd3c6
......@@ -30,7 +30,6 @@ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin, withAbo
from zExceptions import Unauthorized
from DateTime import DateTime
import time
class TestSlapOSAccounting(SlapOSTestCaseMixin):
......@@ -90,138 +89,9 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
)
return invoice
@withAbort
def test_HS_calculateSubscriptionStartDate_REQUEST_disallowed(self):
item = self.createHostingSubscription()
self.assertRaises(
Unauthorized,
item.HostingSubscription_calculateSubscriptionStartDate,
REQUEST={})
@withAbort
def test_HS_calculateSubscriptionStartDate_noWorkflow(self):
item = self.createHostingSubscription()
item.workflow_history['instance_slap_interface_workflow'] = []
date = item.HostingSubscription_calculateSubscriptionStartDate()
self.assertEqual(date, item.getCreationDate().earliestTime())
@withAbort
def test_HS_calculateSubscriptionStartDate_withRequest(self):
item = self.createHostingSubscription()
item.workflow_history['edit_workflow'] = [{
'comment':'Directly request the instance',
'error_message': '',
'actor': 'ERP5TypeTestCase',
'time': DateTime('2012/11/15 11:11'),
'action': 'edit'
}]
date = item.HostingSubscription_calculateSubscriptionStartDate()
self.assertEqual(date, DateTime('2012/11/15'))
@withAbort
def test_HS_calculateSubscriptionStartDate_withRequestEndOfMonth(self):
item = self.createHostingSubscription()
item.workflow_history['edit_workflow'] = [{
'comment':'Directly request the instance',
'error_message': '',
'actor': 'ERP5TypeTestCase',
'time': DateTime('2012/11/30 11:11'),
'action': 'edit'
}]
date = item.HostingSubscription_calculateSubscriptionStartDate()
self.assertEqual(date, DateTime('2012/11/30'))
@withAbort
def test_HS_calculateSubscriptionStopDate_REQUEST_disallowed(self):
item = self.createInstanceTree()
self.assertRaises(
Unauthorized,
item.InstanceTree_calculateSubscriptionStopDate,
REQUEST={})
@withAbort
def test_IT_calculateSubscriptionStopDate_withDestroy(self):
item = self.createInstanceTree()
destroy_date = DateTime('2012/10/30')
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'
})
date = item.InstanceTree_calculateSubscriptionStopDate()
self.assertEqual(date, DateTime('2012/10/31'))
@withAbort
def test_IT_calculateSubscriptionStopDate_noDestroy(self):
item = self.createInstanceTree()
item.workflow_history['instance_slap_interface_workflow'] = []
date = item.InstanceTree_calculateSubscriptionStopDate()
self.assertEqual(date, None)
def test_OpenSaleOrder_reindexIfIndexedBeforeLine_no_line(self):
portal = self.portal
order = self.createOpenSaleOrder()
self.tic()
indexation_timestamp = portal.portal_catalog(
uid=order.getUid(),
select_dict={'indexation_timestamp': None})[0].indexation_timestamp
order.OpenSaleOrder_reindexIfIndexedBeforeLine()
self.tic()
new_indexation_timestamp = portal.portal_catalog(
uid=order.getUid(),
select_dict={'indexation_timestamp': None})[0].indexation_timestamp
self.assertEqual(new_indexation_timestamp,
indexation_timestamp)
def test_OpenSaleOrder_reindexIfIndexedBeforeLine_line_indexed_after(self):
portal = self.portal
order = self.createOpenSaleOrder()
line = order.newContent(portal_type="Open Sale Order Line")
self.tic()
line.activate().immediateReindexObject()
# XXX One more kitten killed
time.sleep(1)
self.tic()
indexation_timestamp = portal.portal_catalog(
uid=order.getUid(),
select_dict={'indexation_timestamp': None})[0].indexation_timestamp
order.OpenSaleOrder_reindexIfIndexedBeforeLine()
self.tic()
new_indexation_timestamp = portal.portal_catalog(
uid=order.getUid(),
select_dict={'indexation_timestamp': None})[0].indexation_timestamp
self.assertNotEqual(new_indexation_timestamp,
indexation_timestamp)
def test_OpenSaleOrder_reindexIfIndexedBeforeLine_line_indexed_before(self):
portal = self.portal
order = self.createOpenSaleOrder()
order.newContent(portal_type="Open Sale Order Line")
self.tic()
order.activate().immediateReindexObject()
# XXX One more kitten killed
time.sleep(1)
self.tic()
indexation_timestamp = portal.portal_catalog(
uid=order.getUid(),
select_dict={'indexation_timestamp': None})[0].indexation_timestamp
order.OpenSaleOrder_reindexIfIndexedBeforeLine()
self.tic()
new_indexation_timestamp = portal.portal_catalog(
uid=order.getUid(),
select_dict={'indexation_timestamp': None})[0].indexation_timestamp
self.assertEqual(new_indexation_timestamp,
indexation_timestamp)
def test_OpenSaleOrder_reindexIfIndexedBeforeLine_REQUEST_disallowed(self):
self.assertRaises(
Unauthorized,
self.portal.OpenSaleOrder_reindexIfIndexedBeforeLine,
REQUEST={})
#################################################################
# SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
#################################################################
def test_SaleInvoiceTransaction_createReversalSaleInvoiceTransaction_redirect_payzen(self):
sale_invoice_transaction = self.createSaleInvoiceTransactionForReversal(payment_mode='payzen')
self.tic()
......@@ -254,6 +124,9 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
"%s doesn't end with %s?portal_status_message=The%%20payment%%20mode%%20is%%20unsupported." % (
redirect, sale_invoice_transaction.getRelativeUrl()))
#################################################################
# SaleInvoiceTransaction_resetPaymentMode
#################################################################
def test_SaleInvoiceTransaction_resetPaymentMode(self):
sale_invoice_transaction = self.portal.accounting_module.newContent(portal_type="Sale Invoice Transaction")
sale_invoice_transaction.edit(payment_mode="unknown",
......@@ -279,6 +152,9 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
sale_invoice_transaction.SaleInvoiceTransaction_resetPaymentMode,
REQUEST={})
#################################################################
# AccountingTransactionModule_getUnpaidInvoiceList
#################################################################
def test_AccountingTransactionModule_getUnpaidInvoiceList(self):
project = self.addProject()
person = self.makePerson(project, user=1)
......@@ -376,6 +252,9 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
[i.getRelativeUrl() for i in unpaid_invoice_list],
[])
#################################################################
# SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
#################################################################
@withAbort
def test_createReversalSaleInvoiceTransaction_bad_portal_type(self):
self.assertRaises(
......@@ -629,6 +508,9 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
def test_createReversalSaleInvoiceTransaction_wechat_ok_dont_autocancel(self):
self.test_createReversalSaleInvoiceTransaction_ok_dont_autocancel(payment_mode='wechat')
#################################################################
# AccountingTransaction_getPaymentState
#################################################################
@withAbort
def test_AccountingTransaction_getPaymentState_draft_payment(self):
invoice = self.createSaleInvoiceTransaction()
......@@ -799,12 +681,18 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
self.assertEqual("Paid",
invoice.AccountingTransaction_getPaymentState())
#################################################################
# Base_getReceivableAccountList
#################################################################
def test_Base_getReceivableAccountList(self):
account_list = self.portal.Base_getReceivableAccountList()
self.assertIn('account_module/receivable',
[i.getRelativeUrl() for i in account_list])
#################################################################
# PaymentTransaction_start
#################################################################
def test_PaymentTransaction_start(self):
sale_invoice_transaction = self.portal.accounting_module.newContent(
......
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