Re: {Disarmed} Re: {Disarmed} [web2py] Re: pytest and controllers protected with auth

2017-09-12 Thread Mathieu Clabaut
Thanks Antonio.
There is a lot to do, unfortunately I really lack time to make this project
advance.
For now I use a py.test to run tests for https://bback.me web site,  but it
is too much tightly coupled with the application to be used as an
independant pytest module. Hence the work in the matclab/pytest-web2py.wip

repo, but alas the availability of time to work on it is a problem.
I'll keep the list informed once (and if) the minimum required tutorial is
available.

On Mon, Sep 11, 2017 at 4:50 PM António Ramos  wrote:

> @Mathieu Clabaut
> I see a lot of space for a Testing tutorial with web2py...
>
> Please sit down and do it :)
> I will buy your book/video especially because there is nothing yet about
> it...
>
> Regards
> António
>
>
> 2017-08-21 7:56 GMT+01:00 Mathieu Clabaut :
>
>> 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 :
>>>
 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 :

> 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 .
>>>
>>>
>>> --
>>> 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.
>>
>
> --
> 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 

Re: {Disarmed} Re: {Disarmed} [web2py] Re: pytest and controllers protected with auth

2017-09-11 Thread António Ramos
@Mathieu Clabaut
I see a lot of space for a Testing tutorial with web2py...

Please sit down and do it :)
I will buy your book/video especially because there is nothing yet about
it...

Regards
António


2017-08-21 7:56 GMT+01:00 Mathieu Clabaut :

> 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 :
>>
>>> 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 :
>>>
 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 .
>>
>>
>> --
>> 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.
>

-- 
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.


Re: {Disarmed} Re: {Disarmed} [web2py] Re: pytest and controllers protected with auth

2017-08-22 Thread Richard Vézina
Will try to wrapp up my stuff... It base on web2py.test, but I add a test
launcher and extract save pytest output into a text file to be consulted
after the ending of the test... I do include this file as a test report
into my app for the client to see that all tests passed... It works with
selenium/splinter, so test are write with splinter API... So it kind of
"merge" of web2py.test and welcome_augmented because of splinter usage...
It use chromedriver or geckodriver (both tested).

I can share that with you...

I will create a dummy app and a basic test case...

Richard

On Mon, Aug 21, 2017 at 5:26 PM, Dave S  wrote:

>
>
> On Monday, August 21, 2017 at 1:53:51 PM UTC-7, Dave S wrote:
>>
>>
>>
>> On Friday, August 18, 2017 at 10:35:01 AM UTC-7, Carlos Cesar Caballero
>> 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.
>>>
>>
>>
>> If you're using the webclient tool, as in the book examples, there is
>> provision for logging in clients.  In one of his posts answering a test
>> question, Massimo recommends putting the test code in modules rather
>> than controllers to avoid exposing the test interface.
>>
>> 
>> (no anchor on the subheader)
>>
>>
> If you need some end-to-end testing using different environments, there's
> browserling.com:
>
> [clipped from one of my old posts] if you need to do testing of your
> website in a lot of browsers, but don't have that many in your own lab,
> 
> might be helpful.  They have an array of target machines with different
> OS/browser combinations and give you a virtual window to them.
>
> To access all the combinations requires subscribing, but the prices aren't
> too bad.  Certainly less than buying 10 used laptops.  For free access, the
> choices are limited and you only get a 3 minute session each try, but even
> that might be helpful.  Additional features include their Bug Hunter tool,
> but maybe you've already been testing with Selenium or another tool.  There
> are also tools for recording and sharing and screenshots.
>
> /dps
>
>
> --
> 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.


Re: {Disarmed} Re: {Disarmed} [web2py] Re: pytest and controllers protected with auth

2017-08-21 Thread Dave S


On Monday, August 21, 2017 at 1:53:51 PM UTC-7, Dave S wrote:
>
>
>
> On Friday, August 18, 2017 at 10:35:01 AM UTC-7, Carlos Cesar Caballero 
> 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.
>>
>
>
> If you're using the webclient tool, as in the book examples, there is 
> provision for logging in clients.  In one of his posts answering a test 
> question, Massimo recommends putting the test code in modules rather than 
> controllers to avoid exposing the test interface.
>
> 
> (no anchor on the subheader)
>
>
If you need some end-to-end testing using different environments, there's 
browserling.com:

[clipped from one of my old posts] if you need to do testing of your 
website in a lot of browsers, but don't have that many in your own lab, 

might be helpful.  They have an array of target machines with different 
OS/browser combinations and give you a virtual window to them.

To access all the combinations requires subscribing, but the prices aren't 
too bad.  Certainly less than buying 10 used laptops.  For free access, the 
choices are limited and you only get a 3 minute session each try, but even 
that might be helpful.  Additional features include their Bug Hunter tool, 
but maybe you've already been testing with Selenium or another tool.  There 
are also tools for recording and sharing and screenshots.

/dps 


-- 
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.


Re: {Disarmed} Re: {Disarmed} [web2py] Re: pytest and controllers protected with auth

2017-08-21 Thread Dave S


On Friday, August 18, 2017 at 10:35:01 AM UTC-7, Carlos Cesar Caballero 
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.
>


If you're using the webclient tool, as in the book examples, there is 
provision for logging in clients.  In one of his posts answering a test 
question, Massimo recommends putting the test code in modules rather than 
controllers to avoid exposing the test interface.

/dps


> 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  >:
>
>> 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 > >:
>>
>>> 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+un...@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 .
>
>
>

-- 
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.


Re: {Disarmed} Re: {Disarmed} [web2py] Re: pytest and controllers protected with auth

2017-08-21 Thread Mathieu Clabaut
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 :
>
>> 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 :
>>
>>> 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 .
>
>
> --
> 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.


{Disarmed} Re: {Disarmed} [web2py] Re: pytest and controllers protected with auth

2017-08-18 Thread Carlos Cesar Caballero Díaz
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 >:


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
Imagem inline 1

2017-08-18 12:46 GMT+01:00 António Ramos >:

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:* 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.