Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python webtest port configuration?

I am attempting to write some tests using webtest to test out my python GAE application. The problem I am running into is that the application is listening on port 8080 but I cannot configure webtest to hit that port.

For example, I want to use app.get('/getreport') to hit http://localhost:8080/getreport. Obviously, it hits just thits http:// localhost/getreport.

Is there a way to set up webtest to hit a particular port?

like image 891
MattM Avatar asked Feb 28 '23 02:02

MattM


1 Answers

With paste.proxy.TransparentProxy you can test anything that responds to an http request...

from webtest import TestApp
from paste.proxy import TransparentProxy
testapp = TestApp(TransparentProxy())
res = testapp.get("http://google.com")
assert res.status=="200 OK","failure....."
like image 150
Tom Willis Avatar answered Mar 12 '23 03:03

Tom Willis