226
226
f.credentials[0])
229
class TestHttpTransportUrls(object):
230
"""Test the http urls.
232
This MUST be used by daughter classes that also inherit from
235
We can't inherit directly from TestCase or the
236
test framework will try to create an instance which cannot
237
run, its implementation being incomplete.
240
def test_abs_url(self):
241
"""Construction of absolute http URLs"""
242
t = self._transport('http://bazaar-vcs.org/bzr/bzr.dev/')
243
eq = self.assertEqualDiff
244
eq(t.abspath('.'), 'http://bazaar-vcs.org/bzr/bzr.dev')
245
eq(t.abspath('foo/bar'), 'http://bazaar-vcs.org/bzr/bzr.dev/foo/bar')
246
eq(t.abspath('.bzr'), 'http://bazaar-vcs.org/bzr/bzr.dev/.bzr')
247
eq(t.abspath('.bzr/1//2/./3'),
248
'http://bazaar-vcs.org/bzr/bzr.dev/.bzr/1/2/3')
250
def test_invalid_http_urls(self):
251
"""Trap invalid construction of urls"""
252
t = self._transport('http://bazaar-vcs.org/bzr/bzr.dev/')
253
self.assertRaises(errors.InvalidURL,
255
'http://http://bazaar-vcs.org/bzr/bzr.dev/')
257
def test_http_root_urls(self):
258
"""Construction of URLs from server root"""
259
t = self._transport('http://bzr.ozlabs.org/')
260
eq = self.assertEqualDiff
261
eq(t.abspath('.bzr/tree-version'),
262
'http://bzr.ozlabs.org/.bzr/tree-version')
264
def test_http_impl_urls(self):
265
"""There are servers which ask for particular clients to connect"""
266
server = self._server()
269
url = server.get_url()
270
self.assertTrue(url.startswith('%s://' % self._qualified_prefix))
275
class TestHttpUrls_urllib(TestHttpTransportUrls, tests.TestCase):
276
"""Test http urls with urllib"""
278
_transport = HttpTransport_urllib
279
_server = http_server.HttpServer_urllib
280
_qualified_prefix = 'http+urllib'
283
class TestHttpUrls_pycurl(TestWithTransport_pycurl, TestHttpTransportUrls,
229
class TestHttpUrls_pycurl(TestWithTransport_pycurl, tests.TestCase):
285
230
"""Test http urls with pycurl"""
287
232
_server = http_server.HttpServer_PyCurl