~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/HttpServer.py

  • Committer: Vincent Ladeuil
  • Date: 2007-03-14 08:12:20 UTC
  • mto: (2323.7.1 redirection)
  • mto: This revision was merged to the branch mainline in revision 2390.
  • Revision ID: v.ladeuil+lp@free.fr-20070314081220-b7rce9vi16r9yd0b
TestingHTTPServer.test_case_server renamed from test_case to avoid confusions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
class TestingHTTPRequestHandler(SimpleHTTPRequestHandler):
44
44
 
45
45
    def log_message(self, format, *args):
46
 
        self.server.test_case.log('webserver - %s - - [%s] %s "%s" "%s"',
47
 
                                  self.address_string(),
48
 
                                  self.log_date_time_string(),
49
 
                                  format % args,
50
 
                                  self.headers.get('referer', '-'),
51
 
                                  self.headers.get('user-agent', '-'))
 
46
        tcs = self.server.test_case_server
 
47
        tcs.log('webserver - %s - - [%s] %s "%s" "%s"',
 
48
                self.address_string(),
 
49
                self.log_date_time_string(),
 
50
                format % args,
 
51
                self.headers.get('referer', '-'),
 
52
                self.headers.get('user-agent', '-'))
52
53
 
53
54
    def handle_one_request(self):
54
55
        """Handle a single HTTP request.
247
248
 
248
249
 
249
250
class TestingHTTPServer(BaseHTTPServer.HTTPServer):
250
 
    def __init__(self, server_address, RequestHandlerClass, test_case):
 
251
 
 
252
    def __init__(self, server_address, RequestHandlerClass,
 
253
                 test_case_server):
251
254
        BaseHTTPServer.HTTPServer.__init__(self, server_address,
252
 
                                                RequestHandlerClass)
253
 
        self.test_case = test_case
 
255
                                           RequestHandlerClass)
 
256
        # test_case_server can be used to communicate between the
 
257
        # tests and the server, allowing dynamic behaviors to be
 
258
        # defined from the tests cases.
 
259
        self.test_case_server = test_case_server
254
260
 
255
261
 
256
262
class HttpServer(Server):