/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to tests/test_commit.py

  • Committer: Vincent Ladeuil
  • Date: 2009-05-28 12:58:49 UTC
  • mto: This revision was merged to the branch mainline in revision 640.
  • Revision ID: v.ladeuil+lp@free.fr-20090528125849-9w4bhdp7cyzjokmh
Fix a leaking dialog windows appearing during the test suite.

* tests/test_commit.py:
(TestReusingSavedCommitMessages._get_commit_dialog): Ensure we
never prompt the user.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1168
1168
        self.build_tree_contents([('tree/a', 'new a content\n'),
1169
1169
                                  ('tree/b', 'new b content'),])
1170
1170
 
 
1171
    def _get_commit_dialog(self, tree):
 
1172
        # Ensure we will never use a dialog that can actually prompt the user
 
1173
        # during the test suite. Test *can* and *should* override with the
 
1174
        # correct question dialog type.
 
1175
        dlg = commit.CommitDialog(tree)
 
1176
        self._set_question_no(dlg)
 
1177
        return dlg
 
1178
 
1171
1179
    def test_setup_saved_messages(self):
1172
1180
        # Check the initial setup
1173
1181
        self.assertEquals(u'two', self._get_commit_message())
1175
1183
                          self._get_file_commit_messages())
1176
1184
 
1177
1185
    def test_messages_are_reloaded(self):
1178
 
        dlg = commit.CommitDialog(self.tree)
 
1186
        dlg = self._get_commit_dialog(self.tree)
1179
1187
        self.assertEquals(u'two', dlg._get_global_commit_message())
1180
1188
        self.assertEquals(([u'a', u'b'],
1181
1189
                           [{ 'path': 'a',
1185
1193
                          dlg._get_specific_files())
1186
1194
 
1187
1195
    def test_messages_are_consumed(self):
1188
 
        dlg = commit.CommitDialog(self.tree)
 
1196
        dlg = self._get_commit_dialog(self.tree)
1189
1197
        dlg._do_commit()
1190
1198
        self.assertEquals(u'', self._get_commit_message())
1191
1199
        self.assertEquals(u'de', self._get_file_commit_messages())
1192
1200
 
1193
1201
    def test_messages_are_saved_on_cancel_if_required(self):
1194
 
        dlg = commit.CommitDialog(self.tree)
 
1202
        dlg = self._get_commit_dialog(self.tree)
1195
1203
        self._set_question_yes(dlg) # Save messages
1196
1204
        dlg._do_cancel()
1197
1205
        self.assertEquals(u'two', self._get_commit_message())
1199
1207
                          self._get_file_commit_messages())
1200
1208
 
1201
1209
    def test_messages_are_cleared_on_cancel_if_required(self):
1202
 
        dlg = commit.CommitDialog(self.tree)
 
1210
        dlg = self._get_commit_dialog(self.tree)
1203
1211
        self._set_question_no(dlg) # Don't save messages
1204
1212
        dlg._do_cancel()
1205
1213
        self.assertEquals(u'', self._get_commit_message())