~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testhttp.py

  • Committer: Martin Pool
  • Date: 2005-07-07 10:22:02 UTC
  • Revision ID: mbp@sourcefrog.net-20050707102201-2d2a13a25098b101
- rearrange and clear up merged weave

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# (C) 2005 Canonical
2
 
 
3
 
from bzrlib.selftest import TestCase
4
 
from bzrlib.transport.http import HttpTransport
5
 
 
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
11
 
        eq(t.abspath('.'),
12
 
           'http://bazaar-ng.org/bzr/bzr.dev')
13
 
        eq(t.abspath('foo/bar'), 
14
 
           'http://bazaar-ng.org/bzr/bzr.dev/foo/bar')
15
 
        eq(t.abspath('.bzr'),
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')
19
 
 
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,
24
 
            t.abspath,
25
 
            '.bzr/')
26
 
        self.assertRaises(ValueError,
27
 
            t.abspath,
28
 
            '/.bzr')
29
 
 
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')