~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/HTTPTestUtil.py

  • Committer: v.ladeuil+lp at free
  • Date: 2006-10-13 08:53:34 UTC
  • mto: (2145.1.1 keepalive)
  • mto: This revision was merged to the branch mainline in revision 2146.
  • Revision ID: v.ladeuil+lp@free.fr-20061013085334-e216654a3e842ff9
Fix bug #57644 by issuing an explicit error message.

* bzrlib/tests/test_http.py:
Fix some doc strings.
(TestForbiddenServer, TestForbiddenServer_urllib,
TestForbiddenServer_pycurl): Tests for correct handling of 403
error code.

* bzrlib/transport/http/_urllib2_wrappers.py:
Cleanup errors import and uses.
(HTTPDefaultErrorHandler.http_error_default): Handles 403 error code.

* bzrlib/transport/http/_pycurl.py:
(PyCurlTransport._raise_curl_http_error): Handles 403 error code.

* bzrlib/tests/HTTPTestUtil.py:
(ForbiddenRequestHandler): New class. An http server where
everything is forbidden.

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
        return False
84
84
 
85
85
 
 
86
class ForbiddenRequestHandler(TestingHTTPRequestHandler):
 
87
    """Whatever request comes in, returns a 403 code"""
 
88
 
 
89
    def parse_request(self):
 
90
        """Handle a single HTTP request, by replying we cannot handle it"""
 
91
        ignored = TestingHTTPRequestHandler.parse_request(self)
 
92
        self.send_error(403)
 
93
        return False
 
94
 
 
95
 
86
96
class TestCaseWithWebserver(TestCaseWithTransport):
87
97
    """A support class that provides readonly urls that are http://.
88
98