/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/blackbox/test_hooks.py

Merge test-run support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from breezy.branch import Branch
20
20
from breezy.tests import TestCaseWithTransport
21
21
 
22
 
 
23
22
def _foo_hook():
24
23
    pass
25
24
 
26
 
 
27
25
class TestHooks(TestCaseWithTransport):
28
26
 
29
27
    def _check_hooks_output(self, command_output, hooks):
40
38
 
41
39
    def test_hooks_with_unnamed_hook(self):
42
40
        self.make_branch('.')
43
 
 
44
41
        def foo(): return
45
42
        Branch.hooks.install_named_hook('post_push', foo, None)
46
43
        out, err = self.run_bzr('hooks')
48
45
 
49
46
    def test_hooks_with_named_hook(self):
50
47
        self.make_branch('.')
51
 
 
52
48
        def foo(): return
53
49
        name = "Foo Bar Hook"
54
50
        Branch.hooks.install_named_hook('post_push', foo, name)
60
56
 
61
57
    def test_hooks_lazy_with_unnamed_hook(self):
62
58
        self.make_branch('.')
63
 
 
64
59
        def foo(): return
65
60
        Branch.hooks.install_named_hook_lazy('post_push',
66
 
                                             'breezy.tests.blackbox.test_hooks',
67
 
                                             '_foo_hook',
68
 
                                             None)
 
61
            'breezy.tests.blackbox.test_hooks',
 
62
            '_foo_hook',
 
63
            None)
69
64
        out, err = self.run_bzr('hooks')
70
65
        self._check_hooks_output(out, {'post_push': ["No hook name"]})
71
 
 
 
66
        
72
67
    def test_hooks_lazy_with_named_hook(self):
73
68
        self.make_branch('.')
74
 
 
75
69
        def foo(): return
76
70
        Branch.hooks.install_named_hook_lazy('post_push',
77
 
                                             'breezy.tests.blackbox.test_hooks',
78
 
                                             '_foo_hook',
79
 
                                             'hook has a name')
 
71
            'breezy.tests.blackbox.test_hooks',
 
72
            '_foo_hook',
 
73
            'hook has a name')
80
74
        out, err = self.run_bzr('hooks')
81
75
        self._check_hooks_output(out, {'post_push': ["hook has a name"]})