I’d like to make sure a given view in my test is fetching an external URL properly. It uses urllib2 (but this shouldn’t matter, since it’s blackbox testing). Perhaps a temporary local server of some kind? Is there an app that does this already? (My Googling has failed me.)
Share
You can use SimpleHTTPServer to rig up a fake web server for testing.
We use the WSGI reference implementation, wsgiref, to rig up a fake web server for testing, also. We like wsgiref because it’s a very clean way to create an extensible mock web server. Further, we have status and shutdown WSGI applications that we use to make sure that everything happened properly from the web site’s point of view.