/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 bzrlib/tests/test_msgeditor.py

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import sys
22
22
 
23
23
from bzrlib import (
 
24
    commit,
24
25
    errors,
25
26
    msgeditor,
26
27
    osutils,
291
292
                              msgeditor.edit_commit_message, '')
292
293
        finally:
293
294
            osutils.set_or_unset_env('LANG', old_env)
 
295
 
 
296
    def test_generate_commit_message_template_no_hooks(self):
 
297
        commit_obj = commit.Commit()
 
298
        self.assertIs(None, 
 
299
            msgeditor.generate_commit_message_template(commit_obj))
 
300
 
 
301
    def test_generate_commit_message_template_hook(self):
 
302
        def restoreDefaults():
 
303
            msgeditor.hooks['commit_message_template'] = []
 
304
        self.addCleanup(restoreDefaults)
 
305
        msgeditor.hooks.install_named_hook("commit_message_template",
 
306
                lambda commit_obj, msg: "save me some typing\n", None)
 
307
        commit_obj = commit.Commit()
 
308
        self.assertEquals("save me some typing\n", 
 
309
            msgeditor.generate_commit_message_template(commit_obj))