[web2py] Testing testing...
Hello all what is the best way to test modules? also why nobody talks about tests in web2py when in every other framework they do it from the beggining. For starters its less noisy but when app grows we eventually need testing skills or we are doomed... PS i saw pytest with web2py and it seems the best option but all examples are 3 years old ... Regards António -- 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.
[web2py] Testing error
hello i get this error without any doctest written [image: Imagem inline 1] -- 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: [web2py] testing applications
You can use the webcliente and after construct the web2pyenv with data of webclient if this is possible.. -- 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: [web2py] testing applications
there is an example in the book about that, logged in user access the page that requires login ref : http://web2py.com/books/default/chapter/29/14/other-recipes#Functional-testing best regards, stifan -- 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: [web2py] testing applications
Hi, there is no problem using the webclient approach, the problem is when I am using the web2pyenv approach ( simulating web2py shell environment), I find it very useful in some cases, but I can't use it with pages that requires registered users. Greetings. El 15/04/17 a las 20:54, Marlysson Silva escribió: You tried use the client web programatically of web2py to submit a post to users/login using your credentials? -- 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: [web2py] testing applications
You tried use the client web programatically of web2py to submit a post to users/login using your credentials? -- 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: [web2py] testing applications
Hi, it looks great. I am testing it and I'm getting issues when I try to test a controller who uses a "@auth.requires_login()" decorator using the web2pyenv approach. I am trying to log in a user using auth.login_bare(), but it always throws a 303 redirect. Any suggestion? Greetings. El 14/04/17 a las 18:58, Marlysson Silva escribió: Have this example: https://github.com/viniciusban/web2py.test -- 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.
[web2py] testing applications
Have this example: https://github.com/viniciusban/web2py.test -- 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.
[web2py] testing applications
Hi, is there a recommended way for implementing test on web2py apps? Greetings. -- 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.
[web2py] testing Recaptcha failed on bizzard error
Hello, https://github.com/web2py/web2py/blob/master/gluon/tools.py#L848 request = request or current.request self.request_vars = request and request.vars or current.request.vars As request would contains current.request why are trying the following assignation... I think it the origin of the failing of : https://ci.appveyor.com/project/web2py/web2py/build/1.0.462 I am not sure why as if I understand correctly current.request should contains the exact same thing as request... At least it is the assomption of the following line and "and-or" tricks... NOTE: Test is passing locally... Richard -- 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.
[web2py] Testing
I do not see my messages in this group. -- 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.
[web2py] Testing and web2py - especially appadmin
I am currently working on creating tests for my default controller, I have found a few articles relating to web2py and unit testing, but not many. I have two questions: 1. Any recommendations for good resources available to help create tests for web2py. 2. Is there a doctest/unit test available for the appadmin controller. Regards, James -- 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.
[web2py] Testing local site on other machine
Hi, I'm running web2py on my laptop with Ubuntu and i'd like to test my websites in IE. So i'd like to test my local web2py website my desktop, which is a Windows machine. How do i achieve this? Thanks in advance. -- 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.
Re: [web2py] Testing local site on other machine
El Mon, 2 Dec 2013 04:46:51 -0800 (PST) Ruud Schroen r...@formatics.nl escribió: Hi, I'm running web2py on my laptop with Ubuntu and i'd like to test my websites in IE. So i'd like to test my local web2py website my desktop, which is a Windows machine. How do i achieve this? Thanks in advance. set 0.0.0.0 ip to web2py and you can browse web2py server in you lan ip port 8000, or you can change port too... -- 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.
[web2py] Testing redirection with py.test
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.
[web2py] Testing if db insert was successful
Hi, I'm unable to figure out how to check when a simple db insert() was successful. In my code below, regardless of whether the db insert is successful or not, the code after 'if new_record:' always executes.. new_record = db.abc.insert(a='this', b='that', c='theotherthing') if new_record: How can I code if db insert was successful: ? Thanks, -J -- --- 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.
[web2py] Testing your app using py.test
Hi guys. I just published an example application with runnable test cases [1]. I don't like doctests, so I used py.test due to some reasons: - I don't need to subclass anything to make my test cases. - py.test understands unittest and nose tests. - py.test fixtures schema is (really) very flexible, allowing me to inject external dependencies. That's the case with Web2py's env(). - I can make assertions using simple Python, with assert statement. This way implements a mix between WebClient and env(), allowing test cases to execute a controller/function() and immediately check with DAL commands if the action was properly executed (i.e, database updated). More details are in docs and inside code. Feel free to fork, collaborate and use it. But give us feedback. [1] https://github.com/viniciusban/web2py.test -- Vinicius Assef -- --- 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.
[web2py] Testing application with Pychecker
Hi. I'm trying to run some tests on our application with Pychecker, but I'm getting this error: TypeError: __import__() takes at most 4 arguments (5 given) Anyone else got this error? Is it possible to test a whole web2py application with Pychecker? Regards, Oliver
[web2py] Testing trunk get error in external iframe on Welcome app index page
I was testing trunk, ran the Welcome application and the Firebug debugger got a script error _gat not defined in file http://static.addtoany.com/menu/sm5.html line 1. Checking the DOM load of the index page I see an iframe iframe id=a2apage_sm_ifr width=1 height=1 frameborder=0 style=border: 0pt none; left: 0pt; top: 0pt; position: absolute; z-index: 10; transparency=true allowtransparency=true src= http://static.addtoany.com/menu/sm5.html#page;http://127.0.0.1:8000/welcome/default/index /iframe which I see comes from lines 100-102 of layout.html Not inside web2py ability to fix other than to include or not include, just so others know. Most of what I work with is on isolated networks so the browser can't reach out to grab external URLs, good for my situation to spot this so I can remove it. Ron
[web2py] Testing ajax autocompletion as said in the book
hello i´m testing ajax auto completion example as said in the book it works fine Now i want to return not the months for the user to select but an image because i´m testing graphviz dot language! the user writes for example a-b an image is created . It see it in the image in the static folder then a-b-C the first images is updated. I see the updated image it in the static folder However in the view in the browser i only see the first image. I have to mousover the image and select update image . Why *My view* {{extend 'layout.html'}} style #suggestions { position: relative; } .suggestions { background: white; border: solid 1px #55A6C8; } .suggestions DIV { padding: 2px 4px 2px 4px; } /style form input type=text id=strCmd name=strCmd style=width: 250px /br / div style=position: absolute; id=suggestions class=suggestions/div /form script jQuery(#strCmd).keyup(function(){ ajax('Graphit', ['strCmd'], 'suggestions')}); /script *Controller:* def Graphit(): temp=request.vars.strCmd print temp if not temp: return '' dott = win32com.client.Dispatch(r'Wingraphviz.dot') img=win32com.client.Dispatch(r'Wingraphviz.BinaryImage') strCMD2 = digraph G {+temp+;} print strCMD2 img=dott.ToGIF(strCMD2) img.Save((os.path.join(request.folder,'static','wf.gif'))) return IMG(_src=URL('static','wf.gif')) Strangers in the night :)
[web2py] Testing RESTful api with curl and JSON
Hello, I am following the restful APIs video on vimeo (http://vimeo.com/ 21133657) Now I am trying to test the manage_dog POST with curl: curl -i -H Accept: application/json -X POST -d info=aNewInfo, owner=55, name=aNewName http://localhost:8000/restful/api/manage_dog/ However, this gives a bad request: HTTP/1.1 400 BAD REQUEST Set-Cookie: session_id_restful=127.0.0.1-31e461ce-6809-403d- b069-6789d7069184; Path=/ Content-Length: 540 Content-Type: text/html; charset=UTF-8 Date: Fri, 19 Aug 2011 08:53:27 GMT Server: Rocket 1.2.2 Python/2.7.1 Connection: keep-alive invalid arguments!-- //-- This works, but gives me the full html response (I'll only post the header): curl -i -d info=aInfoname=aNameowner=74 http://localhost:8000/restful/api/manage_dog HTTP/1.1 200 OK X-Powered-By: web2py Set-Cookie: session_id_restful=127.0.0.1-bc6e42b7- c156-4e58-97cc-991f11cbba38; Path=/ Expires: Fri, 19 Aug 2011 08:59:04 GMT Pragma: no-cache Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre- check=0 Content-Type: text/html; charset=utf-8 Date: Fri, 19 Aug 2011 08:59:04 GMT Server: Rocket 1.2.2 Python/2.7.1 Content-Length: 33287 Connection: keep-alive So my question is: How to post and receive only JSON values? Thanks, Christian P.S: the other things, like e.g. DELETE works perfect curl -i -X DELETE -H Accept: application/json http://localhost:8000/restful/api/manage_dog/4.json and gives: HTTP/1.1 200 OK X-Powered-By: web2py Set-Cookie: session_id_restful=127.0.0.1-3407919a-f841-4f34-8f5e- b74b68449231; Path=/ Expires: Fri, 19 Aug 2011 09:07:31 GMT Pragma: no-cache Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre- check=0 Content-Type: text/html; charset=utf-8 Date: Fri, 19 Aug 2011 09:07:31 GMT Server: Rocket 1.2.2 Python/2.7.1 Content-Length: 3 Connection: keep-alive {}
[web2py] Testing accions that access the database.
Hello, We need to create unit tests for accions that access the database. Does web2py provide tools to do this? The idea is to have a test purpose database and populate it with test data at the moment the tests run. Then, the test would use this fake data populated in the database. Thanks in advance Santiago
[web2py] testing ldap communication?
I'm really stuck here, would greatly appreciate any help. Is there a way to check or test if the DAL is communicating with the ldap ad host? It seems like no matter what settings I used to the server and base_dn, even ones that are obviously wrong, I am only getting the same invalid login error. I read in some older discussion that I should use auth.settings.login_methods = [ldap_auth(mode='ad', . instead of auth.settings.login_methods.append(ldap_auth(mode='ad', . Does this still apply to the current version? I'm trying them both without luck so far.
[web2py] Testing model validation
I'm looking for a hook in web2py that allows me to check if a model is valid. It doesn't have to work 100%, but best-offer, kind of what we have on the web editor right after saving the model file. Is this possible to do for a given file? Thank you, Best regards
[web2py] Testing the new router
Hello, how do I test the new router that Jonathan has made. I renamed the routes.examples.py to routes.py and edited it. No mather what I write in it gets used. I tried to find the answer in all posts on the mailinglist but no success. Kenneth
Re: [web2py] Testing the new router
On Jan 16, 2011, at 1:57 PM, Kenneth Lundström wrote: how do I test the new router that Jonathan has made. I renamed the routes.examples.py to routes.py and edited it. No mather what I write in it gets used. I tried to find the answer in all posts on the mailinglist but no success. Start with router.example.py instead. The key to using the new router is to define a dict named 'routers'. There's more documentation in the file, and I'll repost some examples below. Post your routes.py here, along with a description of what you intend that it does (if it's not obvious). == Suppose you've written an app, named it 'myapp', and want to make it the default, with its name always removed. Your default controller is still 'default', and you want to remove its name from user-visible URLs as well. Here's what you put in routes.py: routers = dict( BASE = dict( default_application='myapp' ), ) That's it. And it's smart enough to know how to do the right thing with URLs like: http://domain.com/myapp/default/myapp or http://domain.com/myapp/myapp/index ...where normal shortening would be ambiguous. If you have two applications, myapp and myapp2, you'll get the same effect, and additionally myapp2's default controller will be stripped from the URL whenever it's safe (which is mostly all the time). Another case. Suppose you want to support URL-based languages, where your URLs look like this: http://myapp/en/some/path or (rewritten) http://en/some/path Here's how: routers = dict( BASE = dict( default_application='myapp' ), myapp = dict( languages=['en', 'it', 'jp'], default_language='en' ), ) Now an incoming URL like this: http:/domain.com/it/some/path will be routed to /myapp/some/path, and request.uri_language will be set to 'it', so you can force the translation. You can also have language-specific static files. http://domain.com/it/static/filename will be mapped to: applications/myapp/static/it/filename ...if that file exists. If it doesn't, then URLs like: http://domain.com/it/static/base.css ...will still map to: applications/myapp/static/base.css (because there is no static/it/base.css) So you can now have language-specific static files, including images, if you need to. Domain mapping is supported as well. routers = dict( BASE = dict( domains = { 'domain1.com' : 'app1', 'domain2.com' : 'app2', } ), ) does what you'd expect. routers = dict( BASE = dict( domains = { 'domain.com:80' : 'app/insecure', 'domain.com:443' : 'app/secure', } ), ) ...maps http://domain.com accesses to app's controller named 'insecure', while https accesses go to the 'secure' controller. Or you can map different ports to different apps, in the obvious way. There's more, but mostly everything happens automatically, and there's no need to dig into the details of configuration unless there's some non-standard thing you need. There's a bit more documentation in router.example.py.
Re: [web2py] Testing the new router
Start with router.example.py instead. The key to using the new router is to define a dict named 'routers'. There's more documentation in the file, and I'll repost some examples below. Post your routes.py here, along with a description of what you intend that it does (if it's not obvious). I just added: routers = dict( BASE = dict( domains = { 'economy.nudata.fi' : 'economy', 'testing.nudata.fi' : 'testapplication', } ), ) but if if go to economy.nudata.fi I get to welcome. Kenneth == Suppose you've written an app, named it 'myapp', and want to make it the default, with its name always removed. Your default controller is still 'default', and you want to remove its name from user-visible URLs as well. Here's what you put in routes.py: routers = dict( BASE = dict( default_application='myapp' ), ) That's it. And it's smart enough to know how to do the right thing with URLs like: http://domain.com/myapp/default/myapp or http://domain.com/myapp/myapp/index ...where normal shortening would be ambiguous. If you have two applications, myapp and myapp2, you'll get the same effect, and additionally myapp2's default controller will be stripped from the URL whenever it's safe (which is mostly all the time). Another case. Suppose you want to support URL-based languages, where your URLs look like this: http://myapp/en/some/path or (rewritten) http://en/some/path Here's how: routers = dict( BASE = dict( default_application='myapp' ), myapp = dict( languages=['en', 'it', 'jp'], default_language='en' ), ) Now an incoming URL like this: http:/domain.com/it/some/path will be routed to /myapp/some/path, and request.uri_language will be set to 'it', so you can force the translation. You can also have language-specific static files. http://domain.com/it/static/filename will be mapped to: applications/myapp/static/it/filename ...if that file exists. If it doesn't, then URLs like: http://domain.com/it/static/base.css ...will still map to: applications/myapp/static/base.css (because there is no static/it/base.css) So you can now have language-specific static files, including images, if you need to. Domain mapping is supported as well. routers = dict( BASE = dict( domains = { 'domain1.com' : 'app1', 'domain2.com' : 'app2', } ), ) does what you'd expect. routers = dict( BASE = dict( domains = { 'domain.com:80' : 'app/insecure', 'domain.com:443' : 'app/secure', } ), ) ...maps http://domain.com accesses to app's controller named 'insecure', while https accesses go to the 'secure' controller. Or you can map different ports to different apps, in the obvious way. There's more, but mostly everything happens automatically, and there's no need to dig into the details of configuration unless there's some non-standard thing you need. There's a bit more documentation in router.example.py.
Re: [web2py] Testing the new router
On Jan 16, 2011, at 2:42 PM, Kenneth Lundström wrote: I just added: routers = dict( BASE = dict( domains = { 'economy.nudata.fi' : 'economy', 'testing.nudata.fi' : 'testapplication', } ), ) but if if go to economy.nudata.fi I get to welcome. Are you running the current trunk? There hasn't been a release with the new router yet. Try adding the abc line below (note the comma); you should get a complaint about an unknown key. routers = dict( BASE = dict( abc = None, domains = { 'economy.nudata.fi' : 'economy', 'testing.nudata.fi' : 'testapplication', } ), )
Re: [web2py] Testing the new router
On Jan 16, 2011, at 2:42 PM, Kenneth Lundström wrote: Start with router.example.py instead. The key to using the new router is to define a dict named 'routers'. There's more documentation in the file, and I'll repost some examples below. Post your routes.py here, along with a description of what you intend that it does (if it's not obvious). I just added: routers = dict( BASE = dict( domains = { 'economy.nudata.fi' : 'economy', 'testing.nudata.fi' : 'testapplication', } ), ) but if if go to economy.nudata.fi I get to welcome. One more question: does this work OK with the old routing logic? Kenneth == Suppose you've written an app, named it 'myapp', and want to make it the default, with its name always removed. Your default controller is still 'default', and you want to remove its name from user-visible URLs as well. Here's what you put in routes.py: routers = dict( BASE = dict( default_application='myapp' ), ) That's it. And it's smart enough to know how to do the right thing with URLs like: http://domain.com/myapp/default/myapp or http://domain.com/myapp/myapp/index ...where normal shortening would be ambiguous. If you have two applications, myapp and myapp2, you'll get the same effect, and additionally myapp2's default controller will be stripped from the URL whenever it's safe (which is mostly all the time). Another case. Suppose you want to support URL-based languages, where your URLs look like this: http://myapp/en/some/path or (rewritten) http://en/some/path Here's how: routers = dict( BASE = dict( default_application='myapp' ), myapp = dict( languages=['en', 'it', 'jp'], default_language='en' ), ) Now an incoming URL like this: http:/domain.com/it/some/path will be routed to /myapp/some/path, and request.uri_language will be set to 'it', so you can force the translation. You can also have language-specific static files. http://domain.com/it/static/filename will be mapped to: applications/myapp/static/it/filename ...if that file exists. If it doesn't, then URLs like: http://domain.com/it/static/base.css ...will still map to: applications/myapp/static/base.css (because there is no static/it/base.css) So you can now have language-specific static files, including images, if you need to. Domain mapping is supported as well. routers = dict( BASE = dict( domains = { 'domain1.com' : 'app1', 'domain2.com' : 'app2', } ), ) does what you'd expect. routers = dict( BASE = dict( domains = { 'domain.com:80' : 'app/insecure', 'domain.com:443' : 'app/secure', } ), ) ...maps http://domain.com accesses to app's controller named 'insecure', while https accesses go to the 'secure' controller. Or you can map different ports to different apps, in the obvious way. There's more, but mostly everything happens automatically, and there's no need to dig into the details of configuration unless there's some non-standard thing you need. There's a bit more documentation in router.example.py.
Re: [web2py] Testing the new router
Are you running the current trunk? There hasn't been a release with the new router yet. Try adding the abc line below (note the comma); you should get a complaint about an unknown key. I´m running the newest Nightly Built? One more question: does this work OK with the old routing logic? I have not used any routing logic so far? Kenneth routers = dict( BASE = dict( abc = None, domains = { 'economy.nudata.fi' : 'economy', 'testing.nudata.fi' : 'testapplication', } ), )
Re: [web2py] Testing the new router
On Jan 16, 2011, at 3:26 PM, Kenneth Lundström wrote: Are you running the current trunk? There hasn't been a release with the new router yet. Try adding the abc line below (note the comma); you should get a complaint about an unknown key. I´m running the newest Nightly Built? One more question: does this work OK with the old routing logic? I have not used any routing logic so far? I'm not sure what's in the nightly build. The abc= line should tell us something, and I can give you a little more debugging depending on what it says. What's your environment? Host system, server configuration, etc? There are some configurations (like mod_proxy) where you have to do domain-based routing at the server rather than web2py, I think. Kenneth routers = dict( BASE = dict( abc = None, domains = { 'economy.nudata.fi' : 'economy', 'testing.nudata.fi' : 'testapplication', } ), )
Re: [web2py] Testing the new router
I'm not sure what's in the nightly build. The abc= line should tell us something, and I can give you a little more debugging depending on what it says. abc gave nothing, it loaded welcome without any errors, or were should I see any complaints about an unknown key? I´m running on linux, CentOS, MySQL, mod_wsgi, Apache. I guess I have to give trunk a go, never used Mercurial so it´ll be an experiment. Kenneth What's your environment? Host system, server configuration, etc? There are some configurations (like mod_proxy) where you have to do domain-based routing at the server rather than web2py, I think. Kenneth routers = dict( BASE = dict( abc = None, domains = { 'economy.nudata.fi' : 'economy', 'testing.nudata.fi' : 'testapplication', } ), )
Re: [web2py] Testing the new router
On Jan 16, 2011, at 4:39 PM, Kenneth Lundström wrote: I'm not sure what's in the nightly build. The abc= line should tell us something, and I can give you a little more debugging depending on what it says. abc gave nothing, it loaded welcome without any errors, or were should I see any complaints about an unknown key? I´m running on linux, CentOS, MySQL, mod_wsgi, Apache. I guess I have to give trunk a go, never used Mercurial so it´ll be an experiment. Yes, you should get a syntax error: raise SyntaxError, unknown key '%s' in router '%s' % (key, app) In this case: unknown key 'abc' in router 'BASE' I'll download the currently nightly and take a look. Kenneth What's your environment? Host system, server configuration, etc? There are some configurations (like mod_proxy) where you have to do domain-based routing at the server rather than web2py, I think. Kenneth routers = dict( BASE = dict( abc = None, domains = { 'economy.nudata.fi' : 'economy', 'testing.nudata.fi' : 'testapplication', } ), )
Re: [web2py] Testing the new router
On Jan 16, 2011, at 4:39 PM, Kenneth Lundström wrote: I'm not sure what's in the nightly build. The abc= line should tell us something, and I can give you a little more debugging depending on what it says. The nightly is pretty old. Massimo?
Re: [web2py] Testing the new router
The nightly is pretty old. Where can you see if my upgrading to a trunk version worked? I did a hg clone https://web. and then copied everything to my web2py folder. Earlier I edited the routes file, now I noticed a new file named router.examples.py. I added those lines to it. But can´t any errors and welcome app is always loaded, Kenneth
Re: [web2py] Testing the new router
On Jan 16, 2011, at 5:08 PM, Kenneth Lundström wrote: The nightly is pretty old. Where can you see if my upgrading to a trunk version worked? I did a hg clone https://web. and then copied everything to my web2py folder. Earlier I edited the routes file, now I noticed a new file named router.examples.py. I added those lines to it. But can´t any errors and welcome app is always loaded, So far so good. You need to copy your router file to routes.py, though. If you cp router.example.py to routes.py and then replace the routers dict with yours, that should be a good start.
Re: [web2py] Testing the new router
So far so good. You need to copy your router file to routes.py, though. If you cp router.example.py to routes.py and then replace the routers dict with yours, that should be a good start. I copied the file, changed ownership, permissions, but nothing. Not until I restarted Apache was the routes.py noticed and used. Now my econopy.nudata.fi goes to economy application the way I wanted. Thank you, Kenneth
Re: [web2py] Testing the new router
On Jan 16, 2011, at 5:27 PM, Kenneth Lundström wrote: So far so good. You need to copy your router file to routes.py, though. If you cp router.example.py to routes.py and then replace the routers dict with yours, that should be a good start. I copied the file, changed ownership, permissions, but nothing. Not until I restarted Apache was the routes.py noticed and used. Now my econopy.nudata.fi goes to economy application the way I wanted. Ah, great. Restarting Apache probably restarted web2py as well, which is necessary for a new routes.py.
[web2py] testing
just testing
Re: [web2py] testing
SyntaxError: line 1: 'just testing' On Fri, Dec 3, 2010 at 4:00 PM, apple simo...@gmail.com wrote: just testing -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
Re: [web2py] testing
On Dec 3, 2010, at 7:09 AM, Branko Vukelic wrote: SyntaxError: line 1: 'just testing' On Fri, Dec 3, 2010 at 4:00 PM, apple simo...@gmail.com wrote: just testing Google Groups has been having some problems today. fwiw.
[web2py] web2py testing release cycle
I was just wondering if it would be possible to have the development team compile a list of features that need tests written for them. I would enjoy writing a few tests, though, I don't have time to dig through the whole code base and figure out on my own what needs testing. Ideally, if you guys could put together a list of features + a general spec for how you would like to see the tests written reported, personally I would be happy to contribute a couple. But I can't do that until you have produced a check list of features. You could even make it into a contest at some point--who can write the most tests in some period of time...
[web2py] Re: web2py testing release cycle
+1 Count me in. I am pretty new to python. But I am sure there are at least one or two simple test cases for me to write tests for. On Oct 31, 1:30 am, b00m_chef r...@devshell.org wrote: I was just wondering if it would be possible to have the development team compile a list of features that need tests written for them. I would enjoy writing a few tests, though, I don't have time to dig through the whole code base and figure out on my own what needs testing. Ideally, if you guys could put together a list of features + a general spec for how you would like to see the tests written reported, personally I would be happy to contribute a couple. But I can't do that until you have produced a check list of features. You could even make it into a contest at some point--who can write the most tests in some period of time...
Re: [web2py] Re: web2py testing release cycle
Ok. Count on me too. I can't organize this, because I'm not an expert in tests, but can contribute with testing. Regards! On Sat, Oct 30, 2010 at 9:03 PM, Luther Goh Lu Feng elf...@yahoo.comwrote: +1 Count me in. I am pretty new to python. But I am sure there are at least one or two simple test cases for me to write tests for. On Oct 31, 1:30 am, b00m_chef r...@devshell.org wrote: I was just wondering if it would be possible to have the development team compile a list of features that need tests written for them. I would enjoy writing a few tests, though, I don't have time to dig through the whole code base and figure out on my own what needs testing. Ideally, if you guys could put together a list of features + a general spec for how you would like to see the tests written reported, personally I would be happy to contribute a couple. But I can't do that until you have produced a check list of features. You could even make it into a contest at some point--who can write the most tests in some period of time...
Re: [web2py] testing app-specific routing
On Aug 9, 2010, at 10:25 PM, Thadeus Burgess wrote: Where is the documentation on how to use it? I sent an email on the subject, and there are comments in routes.example.py. Tomorrow I'll try to add some info to the book in time for Massimo's deadline. Hang on just a minute and I'll try to find the messsage ... a minute passes ... here we are: 1. If you don't explicitly invoke any of the new features, routing should behave identically to before. If you see any different, please let us know asap. 2. You can now have a routes.py in the top level folder of an application, and it will be used *instead* of the base routes.py. However, it's not enough to simply have the file there; you must inform the routing logic about it. 3. The way you inform the routing logic is with a new element in the base routes.py: routes_app. routes_app is processed identically to routes_in, but the output must be an app name (or nothing). routes_app is processed at the beginning of a request. If it produces an app name, and that app has an app-specific routes.py (that is, applications/appname/routes.py), then that routes.py is used instead of the base routes.py. 4. In an unrelated change, there are three other new elements in routes.py: default_application = init default_controller = default default_function = index Note that default_application doesn't interact with app-specfic routing, since it's used after rewrite has taken place. default_controller and default_function should normally be used only in an app-specific routes.py, because, in the base routes.py, they will apply to all apps *without* an app-specific routes.py. That would probably lead to confusion when running admin or examples; at the very least their defaults would break. 5. As usual, I suggest that when you edit routes.example.py to generate a new routes.py, you also edit the doctest at the end, and use it to verify that you're getting what you expect. To run the doctest, just do python routes.py. There's also a patch pending that logs all rewrite operations. MUCH too verbose for production work, but could be useful in diagnosing problems with routes.py. (I think there's a problem with logging in general, though, so some more changes may be necessary.) It's largely untested, but I'll try to respond quickly to bug reports.
Re: [web2py] testing app-specific routing
Where is the documentation on how to use it? -- Thadeus On Mon, Aug 9, 2010 at 5:43 PM, Jonathan Lundell jlund...@pobox.com wrote: Has any tried the new app-specific routing in the trunk? Plan to try it soon?
[web2py] testing routes.py patterns
I've been advocating the use of doctests in routes.py to debug problems. Here's another doctest you can use (I'll send a patch to Massimo that adds an example). compile_re('.*http://otherdomain.com.* (?Pany.*)', '/app/ctr\gany')[0].pattern '^.*http://otherdomain.com.* (?Pany.*)$' compile_re('.*http://otherdomain.com.* (?Pany.*)', '/app/ctr\gany')[1] '/app/ctrgany' compile_re('/$c/$f', '/init/$c/$f')[0].pattern '^.*?:https?://[^:/]+:[a-z]+ /(?Pc[w_]+)/(?Pf[w_]+)$' compile_re('/$c/$f', '/init/$c/$f')[1] '/init/gc/gf' For the trunk version, the import line needs to change to this: from gluon.rewrite import select, load, filter_url, filter_out, filter_err, compile_re Notice that the backslash escaping gets a little confusing. I can't figure out how to use raw strings properly here; so it goes.
Re: [web2py] testing routes.py patterns
On Aug 8, 2010, at 8:31 AM, Jonathan Lundell wrote: I've been advocating the use of doctests in routes.py to debug problems. Here's another doctest you can use (I'll send a patch to Massimo that adds an example). compile_re('.*http://otherdomain.com.* (?Pany.*)', '/app/ctr\gany')[0].pattern '^.*http://otherdomain.com.* (?Pany.*)$' compile_re('.*http://otherdomain.com.* (?Pany.*)', '/app/ctr\gany')[1] '/app/ctrgany' compile_re('/$c/$f', '/init/$c/$f')[0].pattern '^.*?:https?://[^:/]+:[a-z]+ /(?Pc[w_]+)/(?Pf[w_]+)$' compile_re('/$c/$f', '/init/$c/$f')[1] '/init/gc/gf' For the trunk version, the import line needs to change to this: from gluon.rewrite import select, load, filter_url, filter_out, filter_err, compile_re Notice that the backslash escaping gets a little confusing. I can't figure out how to use raw strings properly here; so it goes. One more note. All the other doctests in routes.example.py use the patterns defined earlier in the file. The compile_re tests are entirely self-contained, so you can easily add them without any other editing. Just copy routes.example.py to, say, routes.test.py, and add some compile_re tests, and you're in business.
Re: [web2py] Testing an upload function
Thank you for the directions. I'll try something like that and keep you informed of my progress... -Mathieu On Sat, May 15, 2010 at 22:56, Thadeus Burgess thade...@thadeusb.comwrote: I attempted to solve this by inserting data into the request environment, including the form name, however I did not have any luck.. I would use WebTest for file upload testing instead, however you will need to use a mixture of webtest and new_env(), this is because you need to get the unique _formkey variable so that web2py can validate properly. http://pythonpaste.org/webtest/#making-requests I am thinking of some sample pseudocode below. env = new_env(app='test_upload', controller='default') res = env['upload_a_file']() req = {} for hidden in form.custom.end.elements(): try: if hidden.has_key('_name') and hidden.has_key('_value'): req[hidden['_name']] = hidden['_value'] except AttributeError: pass req['name'] = 'ABOUT.txt' Then continue and use the uploaded_files list in webtest and perform an app.post() on the function. Now you can verify using another new_env that the record was inserted, and you can manually check the existence of the file and its contents. -- Thadeus On Sat, May 15, 2010 at 12:58 PM, Mathieu Clabaut mathieu.clab...@gmail.com wrote: Hello, I'd like to test an upload function in my default controller (I use Thadeus testrunner from web2py_utils). I wonder what object I shall put in my request.post_vars.file where 'file' is the upload field ? Apparently it should have a 'filename' attribute and a read method ? Any tip on how to populate the request for such an upload form ? -Mathieu
Re: [web2py] Testing an upload function
I finally did the following (using a storage with 'filename' and 'file' attributes) without using webtest which seems to work : request.function='upload_photo' resp = upload_photo() photo = Storage() photo.filename = os.path.basename(filename) photo.file = open(filename) set_vars(self.env, _formname = photo_create, file = photo, description = desc, _formkey = resp['form'].formkey, ) resp = upload_photo() print db(db.photo.id0).select() Thadeus, do you want a patch to test_runner documentation for this sort of things (in a Howto section ?) ? -Mathieu On Sun, May 16, 2010 at 09:32, Mathieu Clabaut mathieu.clab...@gmail.comwrote: Thank you for the directions. I'll try something like that and keep you informed of my progress... -Mathieu On Sat, May 15, 2010 at 22:56, Thadeus Burgess thade...@thadeusb.comwrote: I attempted to solve this by inserting data into the request environment, including the form name, however I did not have any luck.. I would use WebTest for file upload testing instead, however you will need to use a mixture of webtest and new_env(), this is because you need to get the unique _formkey variable so that web2py can validate properly. http://pythonpaste.org/webtest/#making-requests I am thinking of some sample pseudocode below. env = new_env(app='test_upload', controller='default') res = env['upload_a_file']() req = {} for hidden in form.custom.end.elements(): try: if hidden.has_key('_name') and hidden.has_key('_value'): req[hidden['_name']] = hidden['_value'] except AttributeError: pass req['name'] = 'ABOUT.txt' Then continue and use the uploaded_files list in webtest and perform an app.post() on the function. Now you can verify using another new_env that the record was inserted, and you can manually check the existence of the file and its contents. -- Thadeus On Sat, May 15, 2010 at 12:58 PM, Mathieu Clabaut mathieu.clab...@gmail.com wrote: Hello, I'd like to test an upload function in my default controller (I use Thadeus testrunner from web2py_utils). I wonder what object I shall put in my request.post_vars.file where 'file' is the upload field ? Apparently it should have a 'filename' attribute and a read method ? Any tip on how to populate the request for such an upload form ? -Mathieu
[web2py] Testing an upload function
Hello, I'd like to test an upload function in my default controller (I use Thadeus testrunner from web2py_utils). I wonder what object I shall put in my request.post_vars.file where 'file' is the upload field ? Apparently it should have a 'filename' attribute and a read method ? Any tip on how to populate the request for such an upload form ? -Mathieu
Re: [web2py] Testing an upload function
I attempted to solve this by inserting data into the request environment, including the form name, however I did not have any luck.. I would use WebTest for file upload testing instead, however you will need to use a mixture of webtest and new_env(), this is because you need to get the unique _formkey variable so that web2py can validate properly. http://pythonpaste.org/webtest/#making-requests I am thinking of some sample pseudocode below. env = new_env(app='test_upload', controller='default') res = env['upload_a_file']() req = {} for hidden in form.custom.end.elements(): try: if hidden.has_key('_name') and hidden.has_key('_value'): req[hidden['_name']] = hidden['_value'] except AttributeError: pass req['name'] = 'ABOUT.txt' Then continue and use the uploaded_files list in webtest and perform an app.post() on the function. Now you can verify using another new_env that the record was inserted, and you can manually check the existence of the file and its contents. -- Thadeus On Sat, May 15, 2010 at 12:58 PM, Mathieu Clabaut mathieu.clab...@gmail.com wrote: Hello, I'd like to test an upload function in my default controller (I use Thadeus testrunner from web2py_utils). I wonder what object I shall put in my request.post_vars.file where 'file' is the upload field ? Apparently it should have a 'filename' attribute and a read method ? Any tip on how to populate the request for such an upload form ? -Mathieu
[web2py] testing the CRM appliance
Hi I am new to Web2py. I am currently testing the CRM appliance which i downloaded from: http://www.web2py.com/appliances/default/show/57 I was happy to be able to easily deploy it to GAE. I have hit a few errors / bugs (?) while clicking around. Should I post them here on the list, on http://web2py.uservoice.comhttp://uservoice.comor any other section of web2py.com? -- Mat -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py:29984] web2py testing example(s)
Could someone point me to good (however you define good) example of test code for a web2py appliance? It looks like the test links in admin only refer to doctests, but I can't find examples of what these might look like for a web2py appliance. There is an entry in AlterEgo (#213) which sets things up using unittest, but I'm finding it hard to generalize from this one example. Thanks in advance, Scott --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:29990] Re: web2py testing example(s)
have you looked through the gluon/tests folder? you can browse it on launchpad if you are not running from the source version: http://bazaar.launchpad.net/~mdipierro/web2py/devel/files On Thu, Sep 3, 2009 at 3:41 PM, Crabby shun...@nycap.rr.com wrote: In particular, the approach from AlterEgo doesn't seem to allow access to the DB, which kind of limits the testing that can be done. Any pointers to how to write tests that involve DB access would be extremely appreciated. Thanks again, Scott On Sep 3, 3:39 pm, Scott Hunter shun...@nycap.rr.com wrote: Could someone point me to good (however you define good) example of test code for a web2py appliance? It looks like the test links in admin only refer to doctests, but I can't find examples of what these might look like for a web2py appliance. There is an entry in AlterEgo (#213) which sets things up using unittest, but I'm finding it hard to generalize from this one example. Thanks in advance, Scott --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---