~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/http_utils.py

  • Committer: John Arbash Meinel
  • Date: 2010-08-13 19:08:57 UTC
  • mto: (5050.17.7 2.2)
  • mto: This revision was merged to the branch mainline in revision 5379.
  • Revision ID: john@arbash-meinel.com-20100813190857-mvzwnimrxvm0zimp
Lots of documentation updates.

We had a lot of http links pointing to the old domain. They should
all now be properly updated to the new domain. (only bazaar-vcs.org
entry left is for pqm, which seems to still reside at the old url.)

Also removed one 'TODO' doc entry about switching to binary xdelta, since
we basically did just that with groupcompress.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005-2010 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
58
58
        """Hand the request off to a smart server instance."""
59
59
        backing = get_transport(self.server.test_case_server._home_dir)
60
60
        chroot_server = chroot.ChrootServer(backing)
61
 
        chroot_server.setUp()
 
61
        chroot_server.start_server()
62
62
        try:
63
63
            t = get_transport(chroot_server.get_url())
64
64
            self.do_POST_inner(t)
65
65
        finally:
66
 
            chroot_server.tearDown()
 
66
            chroot_server.stop_server()
67
67
 
68
68
    def do_POST_inner(self, chrooted_transport):
69
69
        self.send_response(200)
106
106
    one. This will currently fail if the primary transport is not
107
107
    backed by regular disk files.
108
108
    """
 
109
 
 
110
    # This can be overriden or parametrized by daughter clasess if needed, but
 
111
    # it must exist so that the create_transport_readonly_server() method can
 
112
    # propagate it.
 
113
    _protocol_version = None
 
114
 
109
115
    def setUp(self):
110
116
        super(TestCaseWithWebserver, self).setUp()
111
117
        self.transport_readonly_server = http_server.HttpServer
112
118
 
 
119
    def create_transport_readonly_server(self):
 
120
        return self.transport_readonly_server(
 
121
            protocol_version=self._protocol_version)
 
122
 
113
123
 
114
124
class TestCaseWithTwoWebservers(TestCaseWithWebserver):
115
125
    """A support class providing readonly urls on two servers that are http://.
127
137
 
128
138
        This is mostly a hook for daughter classes.
129
139
        """
130
 
        return self.transport_secondary_server()
 
140
        return self.transport_secondary_server(
 
141
            protocol_version=self._protocol_version)
131
142
 
132
143
    def get_secondary_server(self):
133
144
        """Get the server instance for the secondary transport."""
134
145
        if self.__secondary_server is None:
135
146
            self.__secondary_server = self.create_transport_secondary_server()
136
 
            self.__secondary_server.setUp()
137
 
            self.addCleanup(self.__secondary_server.tearDown)
 
147
            self.start_server(self.__secondary_server)
138
148
        return self.__secondary_server
139
149
 
140
150
 
219
229
   def create_transport_secondary_server(self):
220
230
       """Create the secondary server redirecting to the primary server"""
221
231
       new = self.get_readonly_server()
222
 
       redirecting = HTTPServerRedirecting()
 
232
       redirecting = HTTPServerRedirecting(
 
233
           protocol_version=self._protocol_version)
223
234
       redirecting.redirect_to(new.host, new.port)
224
235
       return redirecting
225
236