~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-03-25 08:34:30 UTC
  • mfrom: (3251.4.12 pull-lp)
  • Revision ID: pqm@pqm.ubuntu.com-20080325083430-0w0gjtnkegce7718
Allow pulling from lp: urls (abentley, #181945)

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, 'Testing directory service')
 
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')