~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testhttp.py

  • Committer: Martin Pool
  • Date: 2005-09-05 09:27:11 UTC
  • Revision ID: mbp@sourcefrog.net-20050905092711-f9f5bded3fd82605
- more disentangling of xml storage format from objects

- remove pack_xml and unpack_xml function in favor of 
  serializer object

- test unpacking canned revision xml

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