~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_directory_service.py

  • Committer: Jelmer Vernooij
  • Date: 2011-11-29 01:35:03 UTC
  • mto: This revision was merged to the branch mainline in revision 6325.
  • Revision ID: jelmer@samba.org-20111129013503-7niifv11hd2rihpn
Allow registering custom location aliases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    transport,
22
22
    urlutils,
23
23
    )
24
 
from bzrlib.directory_service import DirectoryServiceRegistry, directories
 
24
from bzrlib.directory_service import (
 
25
    AliasDirectory,
 
26
    DirectoryServiceRegistry,
 
27
    directories,
 
28
    )
25
29
from bzrlib.tests import TestCase, TestCaseWithTransport
26
30
 
27
31
 
107
111
        e = self.assertRaises(errors.UnsetLocationAlias,
108
112
                              directories.dereference, ':parent')
109
113
        self.assertEqual('No parent location assigned.', str(e))
 
114
 
 
115
    def test_register_location_alias(self):
 
116
        branch = self.make_branch('.')
 
117
        self.addCleanup(AliasDirectory.branch_aliases.remove, "booga")
 
118
        AliasDirectory.branch_aliases.register("booga",
 
119
            lambda b: "UHH?", help="Nobody knows")
 
120
        self.assertEquals("UHH?", directories.dereference(":booga"))