/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

  • Committer: Matt Nordhoff
  • Date: 2009-04-04 02:50:01 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4256.
  • Revision ID: mnordhoff@mattnordhoff.com-20090404025001-z1403k0tatmc8l91
Merge bzr.dev, fixing conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Test commit message editor.
18
18
"""
35
35
    edit_commit_message_encoded
36
36
)
37
37
from bzrlib.tests import (
38
 
    iter_suite_tests,
39
 
    probe_bad_non_ascii,
40
 
    split_suite_by_re,
41
38
    TestCaseWithTransport,
42
39
    TestNotApplicable,
43
40
    TestSkipped,
 
41
    multiply_tests,
 
42
    probe_bad_non_ascii,
 
43
    split_suite_by_re,
44
44
    )
45
 
from bzrlib.tests.EncodingAdapter import EncodingTestAdapter
 
45
from bzrlib.tests.EncodingAdapter import encoding_scenarios
46
46
from bzrlib.trace import mutter
47
47
 
48
48
 
50
50
    """Parameterize the test for tempfile creation with different encodings."""
51
51
    to_adapt, result = split_suite_by_re(standard_tests,
52
52
        "test__create_temp_file_with_commit_template_in_unicode_dir")
53
 
    for test in iter_suite_tests(to_adapt):
54
 
        result.addTests(EncodingTestAdapter().adapt(test))
55
 
    return result
 
53
    return multiply_tests(to_adapt, encoding_scenarios, result)
56
54
 
57
55
 
58
56
class MsgEditorTest(TestCaseWithTransport):
69
67
                "filesystem encoding %s" % sys.getfilesystemencoding())
70
68
        working_tree.add(filename)
71
69
        return working_tree
72
 
    
 
70
 
73
71
    def test_commit_template(self):
74
72
        """Test building a commit message template"""
75
73
        working_tree = self.make_uncommitted_tree()
354
352
 
355
353
    def test_generate_commit_message_template_no_hooks(self):
356
354
        commit_obj = commit.Commit()
357
 
        self.assertIs(None, 
 
355
        self.assertIs(None,
358
356
            msgeditor.generate_commit_message_template(commit_obj))
359
357
 
360
358
    def test_generate_commit_message_template_hook(self):
364
362
        msgeditor.hooks.install_named_hook("commit_message_template",
365
363
                lambda commit_obj, msg: "save me some typing\n", None)
366
364
        commit_obj = commit.Commit()
367
 
        self.assertEquals("save me some typing\n", 
 
365
        self.assertEquals("save me some typing\n",
368
366
            msgeditor.generate_commit_message_template(commit_obj))