~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_msgeditor.py

  • Committer: John Arbash Meinel
  • Date: 2006-10-11 00:23:23 UTC
  • mfrom: (2070 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2071.
  • Revision ID: john@arbash-meinel.com-20061011002323-82ba88c293d7caff
[merge] bzr.dev 2070

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005 by Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
 
# it under the terms of the GNU General Public License as published by
5
 
# the Free Software Foundation; either version 2 of the License, or
6
 
# (at your option) any later version.
 
4
# it under the terms of the GNU General Public License version 2 as published by
 
5
# the Free Software Foundation.
7
6
#
8
7
# This program is distributed in the hope that it will be useful,
9
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
80
79
        self.assertEqual(True, bzrlib.msgeditor._run_editor(''),
81
80
                         'Unable to run dummy fake editor')
82
81
 
83
 
    def make_fake_editor(self):
84
 
        """Set up environment so that an editor will be a known script.
85
 
 
86
 
        Sets up BZR_EDITOR so that if an editor is spawned it will run a
87
 
        script that just adds a known message to the start of the file.
88
 
        """
 
82
    def test_edit_commit_message(self):
 
83
        working_tree = self.make_uncommitted_tree()
 
84
        # make fake editor
89
85
        f = file('fed.py', 'wb')
90
86
        f.write('#!%s\n' % sys.executable)
91
87
        f.write("""\
115
111
            os.chmod('fed.py', 0755)
116
112
            os.environ['BZR_EDITOR'] = './fed.py'
117
113
 
118
 
    def test_edit_commit_message(self):
119
 
        working_tree = self.make_uncommitted_tree()
120
 
        self.make_fake_editor()
121
 
 
122
114
        mutter('edit_commit_message without infotext')
123
115
        self.assertEqual('test message from fed\n',
124
116
                         bzrlib.msgeditor.edit_commit_message(''))
127
119
        self.assertEqual('test message from fed\n',
128
120
                         bzrlib.msgeditor.edit_commit_message(u'\u1234'))
129
121
 
130
 
    def test_start_message(self):
131
 
        self.make_uncommitted_tree()
132
 
        self.make_fake_editor()
133
 
        self.assertEqual('test message from fed\nstart message\n',
134
 
                         bzrlib.msgeditor.edit_commit_message('',
135
 
                                              start_message='start message\n'))
136
 
        self.assertEqual('test message from fed\n',
137
 
                         bzrlib.msgeditor.edit_commit_message('',
138
 
                                              start_message=''))
139
 
 
140
122
    def test_deleted_commit_message(self):
141
123
        working_tree = self.make_uncommitted_tree()
142
124