~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: v.ladeuil+lp at free
  • Date: 2006-10-05 09:29:48 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-20061005092948-585bd3d003d5db82
Test protocol version in http responses.

* bzrlib/transport/http/_urllib2_wrappers.py:
(AbstractHTTPHandler.do_open): Catch httplib.UnknownProtocol. Add some
comments.

* bzrlib/transport/http/__init__.py:
(BadProtocolRequestHandler): New class testing protocol validity.

* bzrlib/tests/test_http.py:
(TestWallServer, TestBadStatusServer.create_transport_readonly_server,
TestInvalidStatusServer): Use a readonly server.
(TestBadProtocolServer, TestBadProtocolServer_urllib): New classes
testing protocol version validity.

* bzrlib/tests/__init__.py:
(TestCaseWithMemoryTransport.create_transport_readonly_server): New
hook allowing daughter classes to create specialized servers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1162
1162
        self.assertTrue(t.is_readonly())
1163
1163
        return t
1164
1164
 
 
1165
    def create_transport_readonly_server(self):
 
1166
        """Create a transport server from class defined at init.
 
1167
 
 
1168
        This is mostly a hook for daugter classes.
 
1169
        """
 
1170
        return self.transport_readonly_server()
 
1171
 
1165
1172
    def get_readonly_server(self):
1166
1173
        """Get the server instance for the readonly transport
1167
1174
 
1175
1182
                self.__readonly_server = ReadonlyServer()
1176
1183
                self.__readonly_server.setUp(self.__server)
1177
1184
            else:
1178
 
                self.__readonly_server = self.transport_readonly_server()
 
1185
                self.__readonly_server = self.create_transport_readonly_server()
1179
1186
                self.__readonly_server.setUp()
1180
1187
            self.addCleanup(self.__readonly_server.tearDown)
1181
1188
        return self.__readonly_server