/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

  • Committer: Jelmer Vernooij
  • Date: 2020-03-22 01:35:14 UTC
  • mfrom: (7490.7.6 work)
  • mto: This revision was merged to the branch mainline in revision 7499.
  • Revision ID: jelmer@jelmer.uk-20200322013514-7vw1ntwho04rcuj3
merge lp:brz/3.1.

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