[Erp5-dev] How to test quantity step?

Łukasz Nowak lukasz.nowak at ventis.com.pl
Wed Oct 10 16:12:30 CEST 2007


Hello,

On 2007-10-10, 13:45:27
Łukasz Nowak <lukasz.nowak at ventis.com.pl> wrote:

(...)
> Ok. I'll try to do it by magic with REQUESTs. If I achieve needed
> results I'll share them ASAP. But if anyone has better solution it is
> badly needed.

I'm stucked again.

This is my code snippet:

def stepFillPurchaseSupplyLineDefineRange(self, sequence=None, **kw):
  purchase_supply_line = sequence.get('purchase_supply_line')
  from Testing.makerequest import makerequest
  user_folder = self.getPortal().acl_users
  user = user_folder.getUserById('ERP5TypeTestCase').__of__(user_folder)

  psl = makerequest(purchase_supply_line)
  request = purchase_supply_line.REQUEST
  request['quantity_step_list'] = self.quantity_step_list
  request.AUTHENTICATED_USER = user
  psl.Base_edit(form_id='PurchaseSupplyLine_viewBasePrice')

Which ends up with not so understandable traceback:
Traceback (most recent call last):
  File "/usr/lib/zope/lib/python/Testing/ZopeTestCase/profiler.py",
line 80, in __call__ testMethod()
  File
"/home/shufla/work/erp5instance/unit_test/Products/VentisTests/tests/testVentisPricingOfResourcesWithQuantityStepOnPurchaseSupply.py",
line 400, in
test_01_check_if_pricing_is_correct_if_componet_has_quantity_step_on_purchase_supply
sequence_list.play(self) File
"/home/shufla/work/erp5instance/unit_test/Products/ERP5Type/tests/Sequence.py",
line 122, in play sequence.play(context, sequence_number=i,
quiet=quiet) File
"/home/shufla/work/erp5instance/unit_test/Products/ERP5Type/tests/Sequence.py",
line 72, in play step.play(context, sequence=self, quiet=quiet) File
"/home/shufla/work/erp5instance/unit_test/Products/ERP5Type/tests/Sequence.py",
line 58, in play method(sequence=sequence) File
"/home/shufla/work/erp5instance/unit_test/Products/VentisTests/tests/testVentisPricingOfResourcesWithQuantityStepOnPurchaseSupply.py",
line 208, in stepFillPurchaseSupplyLineDefineRange
psl.Base_edit(form_id='PurchaseSupplyLine_viewBasePrice') File
"/home/shufla/erp5/lib/python/Shared/DC/Scripts/Bindings.py", line 306,
in __call__ return self._bindAndExec(args, kw, None) File
"/home/shufla/erp5/lib/python/Shared/DC/Scripts/Bindings.py", line 343,
in _bindAndExec return self._exec(bound_data, args, kw) File
"/home/shufla/erp5/lib/python/Products/PythonScripts/PythonScript.py",
line 323, in _exec result = f(*args, **kw) File "Script (Python)", line
24, in Base_edit File
"/home/shufla/erp5/lib/python/Products/Formulator/Form.py", line 396,
in validate_all_to_request result = self.validate_all(REQUEST) File
"/home/shufla/work/erp5instance/Products/ERP5Form/Form.py", line 475,
in validate_all value = field.validate(REQUEST) File
"/home/shufla/erp5/lib/python/Products/Formulator/Field.py", line 266,
in validate return self._validate_helper( File
"/home/shufla/erp5/lib/python/Products/Formulator/Field.py", line 255,
in _validate_helper value = self.validator.validate(self, key, REQUEST)
File "/home/shufla/work/erp5instance/Products/ERP5Form/ProxyField.py",
line 125, in validate result = proxy_field.validator.validate(field,
key, REQUEST) File
"/home/shufla/work/erp5instance/Products/ERP5Form/FormulatorPatch.py",
line 951, in validate year = field.validate_sub_field('year', REQUEST,
key=key) File
"/home/shufla/work/erp5instance/Products/ERP5Form/FormulatorPatch.py",
line 90, in Field_validate_sub_field return
self.sub_form.get_field(id)._validate_helper( AttributeError: sub_form

Regards,
Luke

-- 
Łukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...''



More information about the Erp5-dev mailing list