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

Rewrite test and check a bit more.

Having in mind that builders used are those on business process, be interested
only in documents related to hosting subscription.

Check that invoice and payment are generated in excepted states and that it is
possible to invoke typical actions on each of those documents.
parent 92c2baee
...@@ -9,8 +9,8 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin): ...@@ -9,8 +9,8 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
def stepBuildOneMoreSalePackingList(self, sequence, **kw): def stepBuildOneMoreSalePackingList(self, sequence, **kw):
sequence.edit( sequence.edit(
number_of_sale_packing_list=\ number_of_sale_packing_list=sequence.get(
len(self.portal.sale_packing_list_module.contentValues())) 'number_of_sale_packing_list', 0) + 1)
build_before = sequence.get('build_before') build_before = sequence.get('build_before')
if build_before is None: if build_before is None:
build_before = getClosestDate( build_before = getClosestDate(
...@@ -23,31 +23,48 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin): ...@@ -23,31 +23,48 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
sequence.edit(build_before=build_before) sequence.edit(build_before=build_before)
def stepBuildOneMoreInvoice(self, sequence, **kw): def stepBuildOneMoreInvoice(self, sequence, **kw):
sequence.edit(number_of_invoice=\ sequence.edit(number_of_invoice=sequence.get('number_of_invoice', 0) + 1)
len(self.portal.accounting_module.contentValues(
portal_type="Sale Invoice Transaction")))
self.portal.portal_alarms.build_invoice_path.activeSense() self.portal.portal_alarms.build_invoice_path.activeSense()
def stepBuildOneMoreInvoiceTransaction(self, sequence, **kw): def stepBuildOneMoreInvoiceTransaction(self, sequence, **kw):
self.portal.portal_alarms.build_account_path.activeSense() self.portal.portal_alarms.build_account_path.activeSense()
def stepBuildOneMorePayment(self, sequence, **kw): def stepBuildOneMorePayment(self, sequence, **kw):
sequence.edit(number_of_payment=\ sequence.edit(number_of_payment=sequence.get('number_of_payment', 0) + 1)
len(self.portal.accounting_module.contentValues(
portal_type="Payment Transaction")))
self.portal.portal_alarms.build_pay_path.activeSense() self.portal.portal_alarms.build_pay_path.activeSense()
def stepCheckOneMoreDocumentList(self, sequence, **kw):
hosting_subscription = self.portal.portal_catalog\
.getResultValue(uid=sequence['hosting_subscription_uid'])
sale_packing_list_list = self.portal.portal_catalog(
portal_type='Sale Packing List',
causality_relative_url=hosting_subscription.getRelativeUrl(),
sort_on=(('delivery.start_date', "DESC")))
self.assertEqual(sequence['number_of_sale_packing_list'],
len(sale_packing_list_list))
sale_packing_list = sale_packing_list_list[0].getObject()
sale_invoice_transaction_list = sale_packing_list\
.getCausalityRelatedValueList(portal_type='Sale Invoice Transaction')
self.assertEqual(1, len(sale_invoice_transaction_list))
sale_invoice_transaction = sale_invoice_transaction_list[0]
payment_transaction_list = sale_invoice_transaction\
.getCausalityRelatedValueList(portal_type='Payment Transaction')
self.assertEqual(1, len(payment_transaction_list))
payment_transaction = payment_transaction_list[0]
sequence.edit(
current_sale_packing_list=sale_packing_list,
current_sale_invoice_transaction=sale_invoice_transaction,
current_payment_transaction=payment_transaction
)
def stepCheckSalePackingList(self, sequence, **kw): def stepCheckSalePackingList(self, sequence, **kw):
# check one more sale packing list is generated # check one more sale packing list is generated
# and only one sale packing list line is inside # and only one sale packing list line is inside
self.assertEquals( sale_packing_list = sequence['current_sale_packing_list']
len(self.portal.sale_packing_list_module.contentValues()),
sequence.get('number_of_sale_packing_list') + 1)
build_before = sequence.get('build_before')
sale_packing_list = \
self.portal.sale_packing_list_module.contentValues(
portal_type="Sale Packing List",
sort_on=(("creation_date", "DESC"),))[0]
sale_packing_list_line_list = \ sale_packing_list_line_list = \
sale_packing_list.contentValues(portal_type="Sale Packing List Line") sale_packing_list.contentValues(portal_type="Sale Packing List Line")
self.assertEquals(1, len(sale_packing_list_line_list)) self.assertEquals(1, len(sale_packing_list_line_list))
...@@ -81,24 +98,31 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin): ...@@ -81,24 +98,31 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
person.getDestinationDecisionRelatedValue(portal_type="Open Sale Order") person.getDestinationDecisionRelatedValue(portal_type="Open Sale Order")
open_order_line = \ open_order_line = \
open_order.contentValues(portal_type="Open Sale Order Line")[0] open_order.contentValues(portal_type="Open Sale Order Line")[0]
hosting_subscription = \
open_order_line.getAggregateValue(portal_type="Hosting Subscription")
# check related property # check related property
self.assertEquals(open_order_line.getSpecialise(), self.assertEquals(open_order_line.getSpecialise(),
sale_packing_list.getSpecialise()) sale_packing_list.getSpecialise())
def stepCheckInvoiceAndInvoiceTransaction(self, sequence, **kw): def stepCheckInvoiceAndInvoiceTransaction(self, sequence, **kw):
self.assertEquals( sale_invoice_transaction = sequence['current_sale_invoice_transaction']
len(self.portal.accounting_module.contentValues( self.assertEqual(sale_invoice_transaction.getSimulationState(),
portal_type="Sale Invoice Transaction")), 'confirmed')
sequence.get('number_of_invoice') + 1) self.assertEqual(sale_invoice_transaction.getCausalityList(),
[sequence['current_sale_packing_list'].getRelativeUrl()])
self.portal.portal_workflow.doActionFor(sale_invoice_transaction,
'start_action')
self.assertEqual(sale_invoice_transaction.getSimulationState(),
'started')
def stepCheckPayment(self, sequence, **kw): def stepCheckPayment(self, sequence, **kw):
self.assertEquals( payment_transaction = sequence['current_payment_transaction']
len(self.portal.accounting_module.contentValues( self.assertEqual(payment_transaction.getSimulationState(), 'planned')
portal_type="Payment Transaction")), self.assertEqual(payment_transaction.getCausalityList(),
sequence.get('number_of_payment') + 1) [sequence['current_sale_invoice_transaction'].getRelativeUrl()])
self.portal.portal_workflow.doActionFor(payment_transaction,
'confirm_action')
self.assertEqual(payment_transaction.getSimulationState(),
'confirmed')
def test_OpenOrder_sale_packing_list(self): def test_OpenOrder_sale_packing_list(self):
""" """
...@@ -117,7 +141,7 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin): ...@@ -117,7 +141,7 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
Logout Logout
LoginDefaultUser LoginDefaultUser
CheckOne CheckOneMoreDocumentList
CheckSalePackingList CheckSalePackingList
CheckInvoiceAndInvoiceTransaction CheckInvoiceAndInvoiceTransaction
CheckPayment CheckPayment
......
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