~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-05-19 12:53:48 UTC
  • mfrom: (3431.2.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20080519125348-0cj2omrjvzlh88xy
(vila) Make both http implementations raise appropriate exceptions
        when posting smart requests(#230223)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1719
1719
        self.assertEndsWith(response, expected_end_of_response)
1720
1720
 
1721
1721
 
 
1722
class ForbiddenRequestHandler(http_server.TestingHTTPRequestHandler):
 
1723
    """No smart server here request handler."""
 
1724
 
 
1725
    def do_POST(self):
 
1726
        self.send_error(403, "Forbidden")
 
1727
 
 
1728
 
 
1729
class SmartClientAgainstNotSmartServer(TestSpecificRequestHandler):
 
1730
    """Test smart client behaviour against an http server without smarts."""
 
1731
 
 
1732
    _req_handler_class = ForbiddenRequestHandler
 
1733
 
 
1734
    def test_probe_smart_server(self):
 
1735
        """Test error handling against server refusing smart requests."""
 
1736
        server = self.get_readonly_server()
 
1737
        t = self._transport(server.get_url())
 
1738
        # No need to build a valid smart request here, the server will not even
 
1739
        # try to interpret it.
 
1740
        self.assertRaises(errors.SmartProtocolError,
 
1741
                          t.send_http_smart_request, 'whatever')
 
1742