~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/http_server.py

  • Committer: Vincent Ladeuil
  • Date: 2007-11-22 10:35:56 UTC
  • mto: (3928.1.1 bzr.integration)
  • mto: This revision was merged to the branch mainline in revision 3929.
  • Revision ID: v.ladeuil+lp@free.fr-20071122103556-djp1gm22n2npztk0
Add a fake https server and test facilities.

* bzrlib/transport/http/_urllib2_wrappers.py:
(HTTPSConnection.connect_to_origin): Disable ssl wrapping temporarily.

* bzrlib/transport/http/_urllib.py:
(get_test_permutations): Add https tests if a server is available.

* bzrlib/tests/http_server.py:
(TestingHTTPServer): Fix typo.
(HttpServer.get_bogus_url): Use _url_protocol.

* bzrlib/tests/__init__.py:
(_HTTPSServerFeature): Define a feature since an https test server
will have dependencies.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006, 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
32
32
from bzrlib.transport.local import LocalURLServer
33
33
 
34
34
 
35
 
class WebserverNotAvailable(Exception):
36
 
    pass
37
 
 
38
 
 
39
35
class BadWebserverPath(ValueError):
40
36
    def __str__(self):
41
37
        return 'path %s is not in %s' % self.args
264
260
 
265
261
class TestingHTTPServer(BaseHTTPServer.HTTPServer):
266
262
 
267
 
    def __init__(self, server_address, RequestHandlerClass,
 
263
    def __init__(self, server_address, request_handler_class,
268
264
                 test_case_server):
269
265
        BaseHTTPServer.HTTPServer.__init__(self, server_address,
270
 
                                           RequestHandlerClass)
 
266
                                           request_handler_class)
271
267
        # test_case_server can be used to communicate between the
272
268
        # tests and the server (or the request handler and the
273
269
        # server), allowing dynamic behaviors to be defined from
383
379
        """See bzrlib.transport.Server.get_bogus_url."""
384
380
        # this is chosen to try to prevent trouble with proxies, weird dns,
385
381
        # etc
386
 
        return 'http://127.0.0.1:1/'
 
382
        return self._url_protocol + '://127.0.0.1:1/'
387
383
 
388
384
 
389
385
class HttpServer_urllib(HttpServer):