~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testhttp.py

  • Committer: Martin Pool
  • Date: 2005-05-10 08:15:58 UTC
  • Revision ID: mbp@sourcefrog.net-20050510081558-9a38e2c46ba4ebc4
- Patch from Fredrik Lundh to check Python version and 
  try to find a better one if it's too old.

  Patched to try to prevent infinite loops in wierd configurations,
  and to log to stderr.

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')