Richard, in some way, form submission has changed. I don't know
exactly in which version, but now you must set _formkey before form
submission.

I commited some changes.

Now you don't need to import run_controller_in, anymore. Just call
web2py.run() function.
To submit a form, just call web2py.submit()


On Mon, Nov 4, 2013 at 11:48 PM, Richard Vézina
<ml.richard.vez...@gmail.com> wrote:
> Hello Vinicius,
>
> I have been able to run tests, one failed though :
>
> ===================================================================================
> test session starts
> ===================================================================================
> platform linux2 -- Python 2.7.4 -- pytest-2.4.2 --
> /home/noitulove/projets/web2py.test/bin/python
> collected 11 items
>
> applications/people/tests/controllers/test_people_controller_web2pyenv.py:15:
> test_index_exists PASSED
> applications/people/tests/controllers/test_people_controller_web2pyenv.py:29:
> test_new_person_with_form PASSED
> applications/people/tests/controllers/test_people_controller_web2pyenv.py:50:
> test_validate_new_person FAILED
>
> ========================================================================================
> FAILURES
> =========================================================================================
> ________________________________________________________________________________
> test_validate_new_person
> _________________________________________________________________________________
>
> web2py = <Storage {'Service': <class 'gluon.tools.Service'>, 'OBJECT':
> <class 'gluon.ht...ytest/web2pytest.pyc'>, 'T': <gluon.languages.translator
> object at 0x333c450>}>
>
>     def test_validate_new_person(web2py):
>         '''Is the form validating?
>         '''
>
>         from gluon.compileapp import run_controller_in
>
>         data = dict(
>             name='',
>             phone='',
>             _formname='new_person_form',
>         )
>
>         web2py.request.post_vars.update(data)
>         result = run_controller_in('people', 'new_person', web2py)
>
>>       assert result['form'].errors
> E       assert <Storage {}>
> E        +  where <Storage {}> = <gluon.sqlhtml.SQLFORM object at
> 0x335c650>.errors
>
> applications/people/tests/controllers/test_people_controller_web2pyenv.py:65:
> AssertionError
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> Interrupted: stopping after 1 failures
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> ===========================================================================
> 1 failed, 2 passed in 0.25 seconds
> ==========================================================================
>
> I use web2py 2.7.4
>
> I will start to study it.
>
> :)
>
> Richard
>
>
> On Thu, Oct 31, 2013 at 4:08 PM, Vinicius Assef <vinicius...@gmail.com>
> wrote:
>>
>> Yes, that's the way to go. :-)
>>
>> On Thu, Oct 31, 2013 at 2:28 PM, Richard Vézina
>> <ml.richard.vez...@gmail.com> wrote:
>> > Wait, I didn't read carefully web2py.test more complex than I thought, I
>> > thought it was just an app.
>> >
>> > I will set up a virtualenv.
>> >
>> > Richard
>> >
>> >
>> > On Thu, Oct 31, 2013 at 12:08 PM, Richard Vézina
>> > <ml.richard.vez...@gmail.com> wrote:
>> >>
>> >> Ok, I get web2py.test and web2py 2.7.4 (I will test at the same time
>> >> that
>> >> web2py.test works well with it).
>> >>
>> >> Now, https://gist.github.com/viniciusban/7206413 seems just a
>> >> example...
>> >> Should I just add it to web2py.test app?
>> >>
>> >> Richard
>> >>
>> >>
>> >> On Thu, Oct 31, 2013 at 11:39 AM, Vinicius Assef
>> >> <vinicius...@gmail.com>
>> >> wrote:
>> >>>
>> >>> Thank you, Richard.
>> >>>
>> >>> Basically, I need to isolate web2py.test from my example app and
>> >>> prepare better examples.
>> >>>
>> >>>
>> >>>
>> >>> On Thu, Oct 31, 2013 at 11:59 AM, Richard Vézina
>> >>> <ml.richard.vez...@gmail.com> wrote:
>> >>> > I would like to help you Vinicius, what could I do?
>> >>> >
>> >>> > Richard
>> >>> >
>> >>> >
>> >>> > On Thu, Oct 31, 2013 at 6:29 AM, Vinicius Assef
>> >>> > <vinicius...@gmail.com>
>> >>> > wrote:
>> >>> >>
>> >>> >> Good idea.
>> >>> >>
>> >>> >> I'll make it, but it is based on a previous work [1]. I need
>> >>> >> improve
>> >>> >> docs for it.
>> >>> >>
>> >>> >> [1] http://github.com/viniciusban/web2py.test
>> >>> >>
>> >>> >> On Thu, Oct 31, 2013 at 12:11 AM, Massimo Di Pierro
>> >>> >> <massimo.dipie...@gmail.com> wrote:
>> >>> >> > Can you please make a web2py slice about this?
>> >>> >> >
>> >>> >> >
>> >>> >> > On Monday, 28 October 2013 18:13:22 UTC-5, viniciusban wrote:
>> >>> >> >>
>> >>> >> >> I created this gist to help people testing controllers that
>> >>> >> >> makes
>> >>> >> >> redirection:
>> >>> >> >> https://gist.github.com/viniciusban/7206413
>> >>> >> >>
>> >>> >> >> Hope it helps someone.
>> >>> >> >
>> >>> >> > --
>> >>> >> > Resources:
>> >>> >> > - http://web2py.com
>> >>> >> > - http://web2py.com/book (Documentation)
>> >>> >> > - http://github.com/web2py/web2py (Source code)
>> >>> >> > - https://code.google.com/p/web2py/issues/list (Report Issues)
>> >>> >> > ---
>> >>> >> > You received this message because you are subscribed to the
>> >>> >> > Google
>> >>> >> > Groups
>> >>> >> > "web2py-users" group.
>> >>> >> > To unsubscribe from this group and stop receiving emails from it,
>> >>> >> > send
>> >>> >> > an
>> >>> >> > email to web2py+unsubscr...@googlegroups.com.
>> >>> >> > For more options, visit https://groups.google.com/groups/opt_out.
>> >>> >>
>> >>> >> --
>> >>> >> Resources:
>> >>> >> - http://web2py.com
>> >>> >> - http://web2py.com/book (Documentation)
>> >>> >> - http://github.com/web2py/web2py (Source code)
>> >>> >> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> >>> >> ---
>> >>> >> You received this message because you are subscribed to the Google
>> >>> >> Groups
>> >>> >> "web2py-users" group.
>> >>> >> To unsubscribe from this group and stop receiving emails from it,
>> >>> >> send
>> >>> >> an
>> >>> >> email to web2py+unsubscr...@googlegroups.com.
>> >>> >> For more options, visit https://groups.google.com/groups/opt_out.
>> >>> >
>> >>> >
>> >>> > --
>> >>> > Resources:
>> >>> > - http://web2py.com
>> >>> > - http://web2py.com/book (Documentation)
>> >>> > - http://github.com/web2py/web2py (Source code)
>> >>> > - https://code.google.com/p/web2py/issues/list (Report Issues)
>> >>> > ---
>> >>> > You received this message because you are subscribed to the Google
>> >>> > Groups
>> >>> > "web2py-users" group.
>> >>> > To unsubscribe from this group and stop receiving emails from it,
>> >>> > send
>> >>> > an
>> >>> > email to web2py+unsubscr...@googlegroups.com.
>> >>> > For more options, visit https://groups.google.com/groups/opt_out.
>> >>>
>> >>> --
>> >>> Resources:
>> >>> - http://web2py.com
>> >>> - http://web2py.com/book (Documentation)
>> >>> - http://github.com/web2py/web2py (Source code)
>> >>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> >>> ---
>> >>> You received this message because you are subscribed to the Google
>> >>> Groups
>> >>> "web2py-users" group.
>> >>> To unsubscribe from this group and stop receiving emails from it, send
>> >>> an
>> >>> email to web2py+unsubscr...@googlegroups.com.
>> >>> For more options, visit https://groups.google.com/groups/opt_out.
>> >>
>> >>
>> >
>> > --
>> > Resources:
>> > - http://web2py.com
>> > - http://web2py.com/book (Documentation)
>> > - http://github.com/web2py/web2py (Source code)
>> > - https://code.google.com/p/web2py/issues/list (Report Issues)
>> > ---
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "web2py-users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to web2py+unsubscr...@googlegroups.com.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to