162
163
self.assertEqual(made_branch.base, target_branch.base)
163
164
opened_branch = branch_dir.open_branch()
164
165
self.assertEqual(opened_branch.base, target_branch.base)
168
class TestHooks(TestCase):
170
def test_constructor(self):
171
"""Check that creating a BranchHooks instance has the right defaults."""
172
hooks = bzrlib.branch.BranchHooks()
173
self.assertTrue("set_rh" in hooks, "set_rh not in %s" % hooks)
175
def test_installed_hooks_are_BranchHooks(self):
176
"""The installed hooks object should be a BranchHooks."""
177
# the installed hooks are saved in self._preserved_hooks.
178
self.assertIsInstance(self._preserved_hooks, bzrlib.branch.BranchHooks)
180
def test_install_hook_raises_unknown_hook(self):
181
"""install_hook should raise UnknownHook if a hook is unknown."""
182
hooks = bzrlib.branch.BranchHooks()
183
self.assertRaises(UnknownHook, hooks.install_hook, 'silly', None)
185
def test_install_hook_appends_known_hook(self):
186
"""install_hook should append the callable for known hooks."""
187
hooks = bzrlib.branch.BranchHooks()
188
hooks.install_hook('set_rh', None)
189
self.assertEqual(hooks['set_rh'], [None])