~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: Robert Collins
  • Date: 2005-09-30 14:27:41 UTC
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: robertc@robertcollins.net-20050930142741-fc326c828b5bbefd
text_version and name_version unification looking reasonable

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# (C) 2005 Canonical
2
 
 
3
 
from bzrlib.tests 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')