~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_hooks.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-11-03 01:53:30 UTC
  • mfrom: (2955.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20071103015330-pt1tec7wyxwwcey8
Fix #158972 don't use timeout for HttpServer

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_five
27
26
from bzrlib.tests import TestCase
28
27
 
29
28
 
32
31
    def test_install_hook_raises_unknown_hook(self):
33
32
        """install_hook should raise UnknownHook if a hook is unknown."""
34
33
        hooks = Hooks()
35
 
        self.assertRaises(UnknownHook, self.applyDeprecated, one_five,
36
 
                          hooks.install_hook, 'silly', None)
 
34
        self.assertRaises(UnknownHook, hooks.install_hook, 'silly', None)
37
35
 
38
36
    def test_install_hook_appends_known_hook(self):
39
37
        """install_hook should append the callable for known hooks."""
40
38
        hooks = Hooks()
41
39
        hooks['set_rh'] = []
42
 
        self.applyDeprecated(one_five, hooks.install_hook, 'set_rh', None)
43
 
        self.assertEqual(hooks['set_rh'], [None])
44
 
 
45
 
    def test_install_named_hook_raises_unknown_hook(self):
46
 
        hooks = Hooks()
47
 
        self.assertRaises(UnknownHook, hooks.install_named_hook, 'silly',
48
 
                          None, "")
49
 
 
50
 
    def test_install_named_hook_appends_known_hook(self):
51
 
        hooks = Hooks()
52
 
        hooks['set_rh'] = []
53
 
        hooks.install_named_hook('set_rh', None, "demo")
54
 
        self.assertEqual(hooks['set_rh'], [None])
55
 
 
56
 
    def test_install_named_hook_and_retrieve_name(self):
57
 
        hooks = Hooks()
58
 
        hooks['set_rh'] = []
59
 
        hooks.install_named_hook('set_rh', None, "demo")
60
 
        self.assertEqual("demo", hooks.get_hook_name(None))
 
40
        hooks.install_hook('set_rh', None)
 
41
        self.assertEqual(hooks['set_rh'], [None])
61
42
 
62
43
    def test_name_hook_and_retrieve_name(self):
63
44
        """name_hook puts the name in the names mapping."""
64
45
        hooks = Hooks()
65
46
        hooks['set_rh'] = []
66
 
        self.applyDeprecated(one_five, hooks.install_hook, 'set_rh', None)
 
47
        hooks.install_hook('set_rh', None)
67
48
        hooks.name_hook(None, 'demo')
68
49
        self.assertEqual("demo", hooks.get_hook_name(None))
69
50
 
70
51
    def test_get_unnamed_hook_name_is_unnamed(self):
71
52
        hooks = Hooks()
72
53
        hooks['set_rh'] = []
73
 
        self.applyDeprecated(one_five, hooks.install_hook, 'set_rh', None)
 
54
        hooks.install_hook('set_rh', None)
74
55
        self.assertEqual("No hook name", hooks.get_hook_name(None))