~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_hooks.py

  • Committer: Danny van Heumen
  • Date: 2010-03-09 21:42:11 UTC
  • mto: (4634.139.5 2.0)
  • mto: This revision was merged to the branch mainline in revision 5160.
  • Revision ID: danny@dannyvanheumen.nl-20100309214211-iqh42x6qcikgd9p3
Reverted now-useless TODO list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
16
16
 
17
17
"""Tests for the core Hooks logic."""
18
18
 
19
 
from bzrlib import (
20
 
    branch,
21
 
    errors,
22
 
    tests,
23
 
    )
 
19
from bzrlib import branch, errors
24
20
from bzrlib.hooks import (
25
21
    HookPoint,
26
22
    Hooks,
28
24
    known_hooks_key_to_object,
29
25
    known_hooks_key_to_parent_and_attribute,
30
26
    )
31
 
 
32
 
 
33
 
class TestHooks(tests.TestCase):
 
27
from bzrlib.errors import (
 
28
    UnknownHook,
 
29
    )
 
30
 
 
31
from bzrlib.tests import TestCase
 
32
 
 
33
 
 
34
class TestHooks(TestCase):
34
35
 
35
36
    def test_create_hook_first(self):
36
37
        hooks = Hooks()
94
95
 
95
96
    def test_install_named_hook_raises_unknown_hook(self):
96
97
        hooks = Hooks()
97
 
        self.assertRaises(errors.UnknownHook, hooks.install_named_hook, 'silly',
 
98
        self.assertRaises(UnknownHook, hooks.install_named_hook, 'silly',
98
99
                          None, "")
99
100
 
100
101
    def test_install_named_hook_appends_known_hook(self):
110
111
        self.assertEqual("demo", hooks.get_hook_name(None))
111
112
 
112
113
 
113
 
class TestHook(tests.TestCase):
 
114
class TestHook(TestCase):
114
115
 
115
116
    def test___init__(self):
116
117
        doc = ("Invoked after changing the tip of a branch object. Called with"
153
154
            callback_repr, repr(hook))
154
155
 
155
156
 
156
 
class TestHookRegistry(tests.TestCase):
 
157
class TestHookRegistry(TestCase):
157
158
 
158
159
    def test_items_are_reasonable_keys(self):
159
160
        # All the items in the known_hooks registry need to map from
169
170
            new_hooks = factory()
170
171
            self.assertIsInstance(obj, Hooks)
171
172
            self.assertEqual(type(obj), type(new_hooks))
172
 
            self.assertEqual("No hook name", new_hooks.get_hook_name(None))
173
173
 
174
174
    def test_known_hooks_key_to_object(self):
175
175
        self.assertIs(branch.Branch.hooks,