[Erp5-dev] How to test quantity step?

Łukasz Nowak lukasz.nowak at ventis.com.pl
Thu Oct 11 10:06:17 CEST 2007


Hello,

On 2007-10-10, 17:02:12
Jérome Perrin <jerome at nexedi.com> 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')
> 
> It's even more horrible, Base_edit validates the form, so before
> calling it, REQUEST.form must contains formulator keys (you can view
> those in html page source).

Horrible, good to know. Ok - I hope I do not have to pass matrixbox*
fields?
 
> Try something like this:
> 
> request = purchase_supply_line.REQUEST.form
> request['field_my_quantity_step_list'] = self.quantity_step_list
> request['subfield_field_my_start_date_range_max_year'] = '2007'
> request['subfield_field_my_start_date_range_max_month'] = '10'
> request['subfield_field_my_start_date_range_max_day'] = '10'
> 
> and so on...

Tried.
case1-snippet.txt gives case1-traceback.txt.
case2.snippet.txt gives case2-traceback.txt.

> There might be a better solution I'm not aware of, though.

So I'm stucked again. I'm shocked, that so much work is needed to
simulate such important user interaction. Are there any solution? I
tried to invoke edit() on purchase_supply_line, do it all in
activities, wait, do again. Is Base_edit really the only way to achieve
this? Or shall I copy&paste enough from Base_edit to simulate it
without validation?

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...''
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: case1-snippet.txt
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20071011/c34bffaa/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: case1-traceback.txt
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20071011/c34bffaa/attachment-0001.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: case2-snippet.txt
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20071011/c34bffaa/attachment-0002.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: case2-traceback.txt
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20071011/c34bffaa/attachment-0003.txt>


More information about the Erp5-dev mailing list