You may have a look at my work in progress pytest plugin for web2py :
https://github.com/matclab/pytest-web2py.wip

There are some example (with registration in
https://github.com/matclab/pytest-web2py.wip/blob/master/tests/unit-tests/test_default.py

I'm really sorry to not be able to put more time in this project now (some
issues are open to identify what is missing).

-Mathieu

On Fri, Aug 18, 2017 at 7:35 PM Carlos Cesar Caballero Díaz <
carlos.caball...@cfg.jovenclub.cu> wrote:

> I have been facing with that issue too, the error is because there are no
> logged in user, and the redirect is raised, the main problem with this
> approach is that I have been not able to correctly log in a user...
>
> Being honest, I haven't found a satisfactory way for testing web2py
> applications.
>
> Greetings.
>
> El 18/08/17 a las 13:11, António Ramos escribió:
>
> anybody help  please ?
> regards
>
> 2017-08-18 15:20 GMT+01:00 António Ramos <ramstei...@gmail.com>:
>
>> this does not work.
>>
>> *@auth.requires(True, requires_login=  request.is_local)*
>> def execdal():
>> return dict(ret=1)
>>
>>
>> my pytest function
>> def test_execdal(web2py):
>>     result = web2py.run('default', 'execdal', web2py)
>>
>>
>> i get an error about redirected
>> [image: Imagem inline 1]
>>
>> 2017-08-18 12:46 GMT+01:00 António Ramos <ramstei...@gmail.com>:
>>
>>> Hello i+m testing a controller with pytest
>>>
>>> if my controller is protected like
>>>
>>> @auth.requires.login or @auth.requires_membership how can i test it ?
>>>
>>>
>>> def test_controller(client):
>>>
>>>
>>>     client.get('/default/controller')
>>> ...
>>> ...
>>>
>>>
>>> Regards
>>>
>>>
>>>
>>
> --
> 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 *MailScanner ha detectado un intento de fraude en
> la siguiente página web "groups.google.com". No confíe en esta página web:* 
> *MailScanner
> ha detectado un intento de fraude en la siguiente p�gina web
> "groups.google.com". No conf�e en esta p�gina web:*
> https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
>
>
> --
> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to