~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

  • Committer: Aaron Bentley
  • Date: 2008-03-25 01:25:28 UTC
  • mto: This revision was merged to the branch mainline in revision 3304.
  • Revision ID: aaron@aaronbentley.com-20080325012528-mk25xr8eh1uomdyn
Fix wrong local lookups

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    treebuilder,
29
29
    )
30
30
from bzrlib.bzrdir import BzrDir
 
31
from bzrlib.bundle import read_mergeable_from_url
31
32
from bzrlib.bundle.apply_bundle import install_bundle, merge_bundle
32
33
from bzrlib.bundle.bundle_data import BundleTree
 
34
from bzrlib.directory_service import directories
33
35
from bzrlib.bundle.serializer import write_bundle, read_bundle, v09, v4
34
36
from bzrlib.bundle.serializer.v08 import BundleSerializerV08
35
37
from bzrlib.bundle.serializer.v09 import BundleSerializerV09
47
49
    TestCaseInTempDir,
48
50
    TestCaseWithTransport,
49
51
    TestSkipped,
 
52
    test_read_bundle,
50
53
    test_commit,
51
54
    )
52
55
from bzrlib.transform import TreeTransform
1559
1562
        self.assertEqual((None, {'foo': 'bar', 'storage_kind': 'header'},
1560
1563
            'info', None, None), record)
1561
1564
        self.assertRaises(BadBundle, record_iter.next)
 
1565
 
 
1566
 
 
1567
class TestReadMergeableFromUrl(TestCaseWithTransport):
 
1568
 
 
1569
    def test_read_mergeable_skips_local(self):
 
1570
        """A local bundle named like the URL should not be read.
 
1571
        """
 
1572
        out, wt = test_read_bundle.create_bundle_file(self)
 
1573
        class FooService(object):
 
1574
            """A directory service that always returns source"""
 
1575
 
 
1576
            def look_up(self, name, url):
 
1577
                return 'source'
 
1578
        directories.register('foo:', FooService, 'Map foo URLs to http urls')
 
1579
        self.addCleanup(lambda: directories.remove('foo:'))
 
1580
        self.build_tree_contents([('./foo:bar', out.getvalue())])
 
1581
        self.assertRaises(errors.NotABundle, read_mergeable_from_url,
 
1582
                          'foo:bar')