/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

Merge bzr.urllib.keepalive

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
                           )
28
28
from bzrlib.tests import TestCase, TestSkipped
29
29
from bzrlib.transport import Transport
30
 
from bzrlib.transport.http import extract_auth, HttpTransportBase
 
30
from bzrlib.transport.http import (
 
31
    extract_auth,
 
32
    HttpTransportBase,
 
33
    WallRequestHandler,
 
34
    )
31
35
from bzrlib.transport.http._urllib import HttpTransport_urllib
32
 
from bzrlib.tests.HTTPTestUtil import (
33
 
    TestCaseWithWebserver,
34
 
    TestCaseWithWallserver,
35
 
    )
 
36
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver
36
37
 
37
38
 
38
39
class FakeManager (object):
236
237
# way to add an accessor or an attribute to this transports so
237
238
# that we can filter them from the list of all existing
238
239
# transports ?
239
 
class TestWallServer(TestCaseWithWallserver):
240
 
    """Tests that we get the right exceptions during the connection phase"""
 
240
class TestBogusServer(TestCaseWithWebserver):
 
241
    """Abstract class to define test for all bogus servers"""
241
242
 
242
 
    from bzrlib.transport.http._pycurl import PyCurlTransport
243
 
#    _transport = PyCurlTransport
 
243
    #from bzrlib.transport.http._pycurl import PyCurlTransport
 
244
    #_transport = PyCurlTransport
244
245
    _transport = HttpTransport_urllib
245
246
 
246
247
    def test_has(self):
247
 
        server = self.get_readonly_server()
 
248
        server = self.get_server()
248
249
        t = self._transport(server.get_url())
249
250
        self.assertRaises(ConnectionError, t.has, 'foo/bar')
 
251
 
 
252
    def test_get(self):
 
253
        server = self.get_server()
 
254
        t = self._transport(server.get_url())
 
255
        self.assertRaises(ConnectionError, t.get, 'foo/bar')
 
256
 
 
257
 
 
258
class TestWallServer(TestBogusServer):
 
259
    """Tests that we get the right exceptions during the connection phase"""
 
260
    def create_transport_server(self):
 
261
        return bzrlib.transport.http.HttpServer(WallRequestHandler)