~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_hooks.py

  • Committer: Daniel Watkins
  • Date: 2008-04-30 13:21:37 UTC
  • mto: (3394.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 3395.
  • Revision ID: d.m.watkins@warwick.ac.uk-20080430132137-8yqegd3xwbmvkuu9
Updated deprecation warnings and tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    UnknownHook,
24
24
    )
25
25
 
26
 
from bzrlib.symbol_versioning import one_four
 
26
from bzrlib.symbol_versioning import one_five
27
27
from bzrlib.tests import TestCase
28
28
 
29
29
 
32
32
    def test_install_hook_raises_unknown_hook(self):
33
33
        """install_hook should raise UnknownHook if a hook is unknown."""
34
34
        hooks = Hooks()
35
 
        self.assertRaises(UnknownHook, self.applyDeprecated, one_four,
 
35
        self.assertRaises(UnknownHook, self.applyDeprecated, one_five,
36
36
                          hooks.install_hook, 'silly', None)
37
37
 
38
38
    def test_install_hook_appends_known_hook(self):
39
39
        """install_hook should append the callable for known hooks."""
40
40
        hooks = Hooks()
41
41
        hooks['set_rh'] = []
42
 
        self.applyDeprecated(one_four, hooks.install_hook, 'set_rh', None)
 
42
        self.applyDeprecated(one_five, hooks.install_hook, 'set_rh', None)
43
43
        self.assertEqual(hooks['set_rh'], [None])
44
44
 
45
45
    def test_install_named_hook_raises_unknown_hook(self):
64
64
        """name_hook puts the name in the names mapping."""
65
65
        hooks = Hooks()
66
66
        hooks['set_rh'] = []
67
 
        self.applyDeprecated(one_four, hooks.install_hook, 'set_rh', None)
 
67
        self.applyDeprecated(one_five, hooks.install_hook, 'set_rh', None)
68
68
        hooks.name_hook(None, 'demo')
69
69
        self.assertEqual("demo", hooks.get_hook_name(None))
70
70
 
71
71
    def test_get_unnamed_hook_name_is_unnamed(self):
72
72
        hooks = Hooks()
73
73
        hooks['set_rh'] = []
74
 
        self.applyDeprecated(one_four, hooks.install_hook, 'set_rh', None)
 
74
        self.applyDeprecated(one_five, hooks.install_hook, 'set_rh', None)
75
75
        self.assertEqual("No hook name", hooks.get_hook_name(None))