diff --git a/product/ERP5/tests/testPackingList.py b/product/ERP5/tests/testPackingList.py index 650b880cf4cccdd19ed7601565e525275cbf1661..a9f7efabf158afd2e031e25f6784c014beee6b68 100644 --- a/product/ERP5/tests/testPackingList.py +++ b/product/ERP5/tests/testPackingList.py @@ -46,6 +46,8 @@ class TestPackingListMixin(TestOrderMixin): stepCreateOrganisation2 \ stepCreateOrganisation3 \ stepCreateOrder \ + stepCreateCurrency \ + stepSetOrderPriceCurrency \ stepSetOrderProfile \ stepCreateNotVariatedResource \ stepTic \ @@ -66,6 +68,8 @@ class TestPackingListMixin(TestOrderMixin): stepCreateOrganisation2 \ stepCreateOrganisation3 \ stepCreateOrder \ + stepCreateCurrency \ + stepSetOrderPriceCurrency \ stepSetOrderProfile \ stepCreateNotVariatedResource \ stepTic \ @@ -91,6 +95,8 @@ class TestPackingListMixin(TestOrderMixin): stepCreateOrganisation2 \ stepCreateOrganisation3 \ stepCreateOrder \ + stepCreateCurrency \ + stepSetOrderPriceCurrency \ stepSetOrderProfile \ stepCreateVariatedResource \ stepTic \ @@ -144,6 +150,8 @@ class TestPackingListMixin(TestOrderMixin): order.getDestinationAdministration()) self.assertEquals(packing_list.getSourceAdministration(), \ order.getSourceAdministration()) + self.assertEquals(packing_list.getPriceCurrency(), \ + order.getPriceCurrency()) def stepCheckPackingListIsDivergent(self, sequence=None, sequence_list=None, packing_list=None,**kw): @@ -628,7 +636,32 @@ class TestPackingListMixin(TestOrderMixin): self.stepCheckPackingListIsPacked(sequence=sequence, packing_list=packing_list) + def stepCreateCurrency(self, sequence, **kw) : + """Create a default currency. """ + currency_module = self.getCurrencyModule() + if len(currency_module.objectValues(id='EUR'))==0: + currency = self.getCurrencyModule().newContent( + portal_type='Currency', + id="EUR", + base_unit_quantity=0.01, + ) + else: + currency = currency_module.objectValues(id='EUR')[0] + sequence.edit(currency=currency) + + def stepSetOrderPriceCurrency(self, sequence, **kw) : + """Set the price currency of the order. + + This step is not necessary. + TODO : - include a test without this step. + - include a test with this step late. + """ + currency = sequence.get('currency') + order = sequence.get('order') + order.setPriceCurrency(currency.getRelativeUrl()) + + class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : run_all_test = 1