3
from bzrlib.selftest import TestCase
4
from bzrlib.transport.http import HttpTransport
6
class TestHttpUrls(TestCase):
7
def test_abs_url(self):
8
"""Construction of absolute http URLs"""
9
t = HttpTransport('http://bazaar-ng.org/bzr/bzr.dev/')
10
eq = self.assertEqualDiff
12
'http://bazaar-ng.org/bzr/bzr.dev')
13
eq(t.abspath('foo/bar'),
14
'http://bazaar-ng.org/bzr/bzr.dev/foo/bar')
16
'http://bazaar-ng.org/bzr/bzr.dev/.bzr')
17
eq(t.abspath('.bzr/1//2/./3'),
18
'http://bazaar-ng.org/bzr/bzr.dev/.bzr/1/2/3')
20
def test_invalid_http_urls(self):
21
"""Trap invalid construction of urls"""
22
t = HttpTransport('http://bazaar-ng.org/bzr/bzr.dev/')
23
self.assertRaises(ValueError,
26
self.assertRaises(ValueError,
30
def test_http_root_urls(self):
31
"""Construction of URLs from server root"""
32
t = HttpTransport('http://bzr.ozlabs.org/')
33
eq = self.assertEqualDiff
34
eq(t.abspath('.bzr/tree-version'),
35
'http://bzr.ozlabs.org/.bzr/tree-version')