~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: Vincent Ladeuil
  • Date: 2007-12-23 17:48:27 UTC
  • mto: (3146.3.1 179368) (3156.2.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 3158.
  • Revision ID: v.ladeuil+lp@free.fr-20071223174827-sepgat9fxmpnax0f
Rework TestingHTTPServer classes, fix test bug.

* bzrlib/tests/test_http.py:
(TestRanges.create_transport_readonly_server): Take test
parameters into account !

* bzrlib/tests/http_server.py:
(TestingHTTPServerMixin): Replace the wrapper hack.
(TestingHTTPServerMixin.tearDown): The final explanation about
request handlers termination.
(HttpServer.tearDown): Stop messing around trying to find the
right method name, use tearDown and delegate to server classes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
559
559
 
560
560
    def test_http_has(self):
561
561
        if self._testing_pycurl() and self._protocol_version == 'HTTP/1.1':
562
 
            raise tests.KnownFailure('pycurl hangs if the server send back garbage')
 
562
            raise tests.KnownFailure(
 
563
                'pycurl hangs if the server send back garbage')
563
564
        super(TestInvalidStatusServer, self).test_http_has()
564
565
 
565
566
    def test_http_get(self):
566
567
        if self._testing_pycurl() and self._protocol_version == 'HTTP/1.1':
567
 
            raise tests.KnownFailure('pycurl hangs if the server send back garbage')
 
568
            raise tests.KnownFailure(
 
569
                'pycurl hangs if the server send back garbage')
568
570
        super(TestInvalidStatusServer, self).test_http_get()
569
571
 
570
572
 
815
817
class TestLimitedRangeRequestServer(http_utils.TestCaseWithWebserver):
816
818
    """Tests readv requests against a server erroring out on too much ranges."""
817
819
 
 
820
    # Requests with more range specifiers will error out
818
821
    range_limit = 3
819
822
 
820
823
    def create_transport_readonly_server(self):
821
 
        # Requests with more range specifiers will error out
822
824
        return LimitedRangeHTTPServer(range_limit=self.range_limit,
823
825
                                      protocol_version=self._protocol_version)
824
826
 
1013
1015
        server = self.get_readonly_server()
1014
1016
        self.transport = self._transport(server.get_url())
1015
1017
 
 
1018
    def create_transport_readonly_server(self):
 
1019
        return http_server.HttpServer(protocol_version=self._protocol_version)
 
1020
 
1016
1021
    def _file_contents(self, relpath, ranges):
1017
1022
        offsets = [ (start, end - start + 1) for start, end in ranges]
1018
1023
        coalesce = self.transport._coalesce_offsets