Merge lp:~raoul-snyman/openlp/off-by-one-2.4 into lp:openlp/2.4

Proposed by Raoul Snyman
Status: Merged
Merged at revision: 2674
Proposed branch: lp:~raoul-snyman/openlp/off-by-one-2.4
Merge into: lp:openlp/2.4
Diff against target: 410 lines (+247/-25)
3 files modified
openlp/plugins/songs/forms/editsongform.py (+30/-24)
tests/functional/openlp_plugins/songs/test_editsongform.py (+2/-1)
tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py (+215/-0)
To merge this branch: bzr merge lp:~raoul-snyman/openlp/off-by-one-2.4
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Review via email: mp+318720@code.launchpad.net

This proposal supersedes a proposal from 2017-03-02.

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2016-12-31 11:05:48 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2017-03-02 05:06:04 +0000
@@ -31,7 +31,8 @@
3131
32from PyQt5 import QtCore, QtWidgets32from PyQt5 import QtCore, QtWidgets
3333
34from openlp.core.common import Registry, RegistryProperties, AppLocation, UiStrings, check_directory_exists, translate34from openlp.core.common import Registry, RegistryProperties, AppLocation, UiStrings, check_directory_exists, \
35 translate, is_macosx
35from openlp.core.lib import FileDialog, PluginStatus, MediaType, create_separated_list36from openlp.core.lib import FileDialog, PluginStatus, MediaType, create_separated_list
36from openlp.core.lib.ui import set_case_insensitive_completer, critical_error_message_box, find_and_set_in_combo_box37from openlp.core.lib.ui import set_case_insensitive_completer, critical_error_message_box, find_and_set_in_combo_box
37from openlp.plugins.songs.lib import VerseType, clean_song38from openlp.plugins.songs.lib import VerseType, clean_song
@@ -118,7 +119,8 @@
118 cache.append(obj.name)119 cache.append(obj.name)
119 combo.setItemData(row, obj.id)120 combo.setItemData(row, obj.id)
120 set_case_insensitive_completer(cache, combo)121 set_case_insensitive_completer(cache, combo)
121 combo.setEditText('')122 combo.setCurrentIndex(-1)
123 combo.setCurrentText('')
122124
123 def _add_author_to_list(self, author, author_type):125 def _add_author_to_list(self, author, author_type):
124 """126 """
@@ -352,7 +354,8 @@
352 self.authors_combo_box.setItemData(row, author.id)354 self.authors_combo_box.setItemData(row, author.id)
353 self.authors.append(author.display_name)355 self.authors.append(author.display_name)
354 set_case_insensitive_completer(self.authors, self.authors_combo_box)356 set_case_insensitive_completer(self.authors, self.authors_combo_box)
355 self.authors_combo_box.setEditText('')357 self.authors_combo_box.setCurrentIndex(-1)
358 self.authors_combo_box.setCurrentText('')
356359
357 # Types360 # Types
358 self.author_types_combo_box.clear()361 self.author_types_combo_box.clear()
@@ -382,7 +385,8 @@
382 self.themes = theme_list385 self.themes = theme_list
383 self.theme_combo_box.addItems(theme_list)386 self.theme_combo_box.addItems(theme_list)
384 set_case_insensitive_completer(self.themes, self.theme_combo_box)387 set_case_insensitive_completer(self.themes, self.theme_combo_box)
385 self.theme_combo_box.setEditText('')388 self.theme_combo_box.setCurrentIndex(-1)
389 self.theme_combo_box.setCurrentText('')
386390
387 def load_media_files(self):391 def load_media_files(self):
388 """392 """
@@ -421,7 +425,8 @@
421 self.load_topics()425 self.load_topics()
422 self.load_songbooks()426 self.load_songbooks()
423 self.load_media_files()427 self.load_media_files()
424 self.theme_combo_box.setEditText('')428 self.theme_combo_box.setCurrentIndex(-1)
429 self.theme_combo_box.setCurrentText('')
425 # it's a new song to preview is not possible430 # it's a new song to preview is not possible
426 self.preview_button.setVisible(False)431 self.preview_button.setVisible(False)
427432
@@ -446,8 +451,8 @@
446 find_and_set_in_combo_box(self.theme_combo_box, str(self.song.theme_name))451 find_and_set_in_combo_box(self.theme_combo_box, str(self.song.theme_name))
447 else:452 else:
448 # Clear the theme combo box in case it was previously set (bug #1212801)453 # Clear the theme combo box in case it was previously set (bug #1212801)
449 self.theme_combo_box.setEditText('')454 self.theme_combo_box.setCurrentIndex(-1)
450 self.theme_combo_box.setCurrentIndex(0)455 self.theme_combo_box.setCurrentText('')
451 self.copyright_edit.setText(self.song.copyright if self.song.copyright else '')456 self.copyright_edit.setText(self.song.copyright if self.song.copyright else '')
452 self.comments_edit.setPlainText(self.song.comments if self.song.comments else '')457 self.comments_edit.setPlainText(self.song.comments if self.song.comments else '')
453 self.ccli_number_edit.setText(self.song.ccli_number if self.song.ccli_number else '')458 self.ccli_number_edit.setText(self.song.ccli_number if self.song.ccli_number else '')
@@ -550,12 +555,7 @@
550 item = int(self.authors_combo_box.currentIndex())555 item = int(self.authors_combo_box.currentIndex())
551 text = self.authors_combo_box.currentText().strip(' \r\n\t')556 text = self.authors_combo_box.currentText().strip(' \r\n\t')
552 author_type = self.author_types_combo_box.itemData(self.author_types_combo_box.currentIndex())557 author_type = self.author_types_combo_box.itemData(self.author_types_combo_box.currentIndex())
553 # This if statement is for OS X, which doesn't seem to work well with558 if item == -1 and text:
554 # the QCompleter auto-completion class. See bug #812628.
555 if text in self.authors:
556 # Index 0 is a blank string, so add 1
557 item = self.authors.index(text) + 1
558 if item == 0 and text:
559 if QtWidgets.QMessageBox.question(559 if QtWidgets.QMessageBox.question(
560 self,560 self,
561 translate('SongsPlugin.EditSongForm', 'Add Author'),561 translate('SongsPlugin.EditSongForm', 'Add Author'),
@@ -570,10 +570,11 @@
570 self.manager.save_object(author)570 self.manager.save_object(author)
571 self._add_author_to_list(author, author_type)571 self._add_author_to_list(author, author_type)
572 self.load_authors()572 self.load_authors()
573 self.authors_combo_box.setEditText('')573 self.authors_combo_box.setCurrentIndex(-1)
574 self.authors_combo_box.setCurrentText('')
574 else:575 else:
575 return576 return
576 elif item > 0:577 elif item >= 0:
577 item_id = (self.authors_combo_box.itemData(item))578 item_id = (self.authors_combo_box.itemData(item))
578 author = self.manager.get_object(Author, item_id)579 author = self.manager.get_object(Author, item_id)
579 if self.authors_list_view.findItems(author.get_display_name(author_type), QtCore.Qt.MatchExactly):580 if self.authors_list_view.findItems(author.get_display_name(author_type), QtCore.Qt.MatchExactly):
@@ -581,7 +582,8 @@
581 message=translate('SongsPlugin.EditSongForm', 'This author is already in the list.'))582 message=translate('SongsPlugin.EditSongForm', 'This author is already in the list.'))
582 else:583 else:
583 self._add_author_to_list(author, author_type)584 self._add_author_to_list(author, author_type)
584 self.authors_combo_box.setEditText('')585 self.authors_combo_box.setCurrentIndex(-1)
586 self.authors_combo_box.setCurrentText('')
585 else:587 else:
586 QtWidgets.QMessageBox.warning(588 QtWidgets.QMessageBox.warning(
587 self, UiStrings().NISs,589 self, UiStrings().NISs,
@@ -633,7 +635,7 @@
633 def on_topic_add_button_clicked(self):635 def on_topic_add_button_clicked(self):
634 item = int(self.topics_combo_box.currentIndex())636 item = int(self.topics_combo_box.currentIndex())
635 text = self.topics_combo_box.currentText()637 text = self.topics_combo_box.currentText()
636 if item == 0 and text:638 if item == -1 and text:
637 if QtWidgets.QMessageBox.question(639 if QtWidgets.QMessageBox.question(
638 self, translate('SongsPlugin.EditSongForm', 'Add Topic'),640 self, translate('SongsPlugin.EditSongForm', 'Add Topic'),
639 translate('SongsPlugin.EditSongForm', 'This topic does not exist, do you want to add it?'),641 translate('SongsPlugin.EditSongForm', 'This topic does not exist, do you want to add it?'),
@@ -645,10 +647,11 @@
645 topic_item.setData(QtCore.Qt.UserRole, topic.id)647 topic_item.setData(QtCore.Qt.UserRole, topic.id)
646 self.topics_list_view.addItem(topic_item)648 self.topics_list_view.addItem(topic_item)
647 self.load_topics()649 self.load_topics()
648 self.topics_combo_box.setEditText('')650 self.topics_combo_box.setCurrentIndex(-1)
651 self.topics_combo_box.setCurrentText('')
649 else:652 else:
650 return653 return
651 elif item > 0:654 elif item >= 0:
652 item_id = (self.topics_combo_box.itemData(item))655 item_id = (self.topics_combo_box.itemData(item))
653 topic = self.manager.get_object(Topic, item_id)656 topic = self.manager.get_object(Topic, item_id)
654 if self.topics_list_view.findItems(str(topic.name), QtCore.Qt.MatchExactly):657 if self.topics_list_view.findItems(str(topic.name), QtCore.Qt.MatchExactly):
@@ -658,7 +661,8 @@
658 topic_item = QtWidgets.QListWidgetItem(str(topic.name))661 topic_item = QtWidgets.QListWidgetItem(str(topic.name))
659 topic_item.setData(QtCore.Qt.UserRole, topic.id)662 topic_item.setData(QtCore.Qt.UserRole, topic.id)
660 self.topics_list_view.addItem(topic_item)663 self.topics_list_view.addItem(topic_item)
661 self.topics_combo_box.setEditText('')664 self.topics_combo_box.setCurrentIndex(-1)
665 self.topics_combo_box.setCurrentText('')
662 else:666 else:
663 QtWidgets.QMessageBox.warning(667 QtWidgets.QMessageBox.warning(
664 self, UiStrings().NISs,668 self, UiStrings().NISs,
@@ -678,7 +682,7 @@
678 def on_songbook_add_button_clicked(self):682 def on_songbook_add_button_clicked(self):
679 item = int(self.songbooks_combo_box.currentIndex())683 item = int(self.songbooks_combo_box.currentIndex())
680 text = self.songbooks_combo_box.currentText()684 text = self.songbooks_combo_box.currentText()
681 if item == 0 and text:685 if item == -1 and text:
682 if QtWidgets.QMessageBox.question(686 if QtWidgets.QMessageBox.question(
683 self, translate('SongsPlugin.EditSongForm', 'Add Songbook'),687 self, translate('SongsPlugin.EditSongForm', 'Add Songbook'),
684 translate('SongsPlugin.EditSongForm', 'This Songbook does not exist, do you want to add it?'),688 translate('SongsPlugin.EditSongForm', 'This Songbook does not exist, do you want to add it?'),
@@ -688,11 +692,12 @@
688 self.manager.save_object(songbook)692 self.manager.save_object(songbook)
689 self.add_songbook_entry_to_list(songbook.id, songbook.name, self.songbook_entry_edit.text())693 self.add_songbook_entry_to_list(songbook.id, songbook.name, self.songbook_entry_edit.text())
690 self.load_songbooks()694 self.load_songbooks()
691 self.songbooks_combo_box.setEditText('')695 self.songbooks_combo_box.setCurrentIndex(-1)
696 self.songbooks_combo_box.setCurrentText('')
692 self.songbook_entry_edit.clear()697 self.songbook_entry_edit.clear()
693 else:698 else:
694 return699 return
695 elif item > 0:700 elif item >= 0:
696 item_id = (self.songbooks_combo_box.itemData(item))701 item_id = (self.songbooks_combo_box.itemData(item))
697 songbook = self.manager.get_object(Book, item_id)702 songbook = self.manager.get_object(Book, item_id)
698 if self.songbooks_list_view.findItems(str(songbook.name), QtCore.Qt.MatchExactly):703 if self.songbooks_list_view.findItems(str(songbook.name), QtCore.Qt.MatchExactly):
@@ -700,7 +705,8 @@
700 message=translate('SongsPlugin.EditSongForm', 'This Songbook is already in the list.'))705 message=translate('SongsPlugin.EditSongForm', 'This Songbook is already in the list.'))
701 else:706 else:
702 self.add_songbook_entry_to_list(songbook.id, songbook.name, self.songbook_entry_edit.text())707 self.add_songbook_entry_to_list(songbook.id, songbook.name, self.songbook_entry_edit.text())
703 self.songbooks_combo_box.setEditText('')708 self.songbooks_combo_box.setCurrentIndex(-1)
709 self.songbooks_combo_box.setCurrentText('')
704 self.songbook_entry_edit.clear()710 self.songbook_entry_edit.clear()
705 else:711 else:
706 QtWidgets.QMessageBox.warning(712 QtWidgets.QMessageBox.warning(
707713
=== modified file 'tests/functional/openlp_plugins/songs/test_editsongform.py'
--- tests/functional/openlp_plugins/songs/test_editsongform.py 2016-12-31 11:05:48 +0000
+++ tests/functional/openlp_plugins/songs/test_editsongform.py 2017-03-02 05:06:04 +0000
@@ -106,4 +106,5 @@
106 mocked_cache.append.assert_called_once_with('Charles')106 mocked_cache.append.assert_called_once_with('Charles')
107 mocked_combo.setItemData.assert_called_once_with(0, 1)107 mocked_combo.setItemData.assert_called_once_with(0, 1)
108 mocked_set_case_insensitive_completer.assert_called_once_with(mocked_cache, mocked_combo)108 mocked_set_case_insensitive_completer.assert_called_once_with(mocked_cache, mocked_combo)
109 mocked_combo.setEditText.assert_called_once_with('')109 mocked_combo.setCurrentIndex.assert_called_once_with(-1)
110 mocked_combo.setCurrentText.assert_called_once_with('')
110111
=== modified file 'tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py'
--- tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py 2016-12-31 11:05:48 +0000
+++ tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py 2017-03-02 05:06:04 +0000
@@ -23,6 +23,7 @@
23Package to test the openlp.plugins.songs.forms.authorsform package.23Package to test the openlp.plugins.songs.forms.authorsform package.
24"""24"""
25from unittest import TestCase25from unittest import TestCase
26from unittest.mock import patch
2627
27from PyQt5 import QtWidgets28from PyQt5 import QtWidgets
2829
@@ -138,3 +139,217 @@
138139
139 # THEN: The display_name_edit should have the correct value140 # THEN: The display_name_edit should have the correct value
140 self.assertEqual(self.form.display_edit.text(), display_name, 'The display name should be set correctly')141 self.assertEqual(self.form.display_edit.text(), display_name, 'The display name should be set correctly')
142
143 @patch('openlp.plugins.songs.forms.authorsform.QtWidgets.QDialog.exec')
144 def test_exec(self, mocked_exec):
145 """
146 Test the exec() method
147 """
148 # GIVEN: An authors for and various mocked objects
149 with patch.object(self.form.first_name_edit, 'clear') as mocked_first_name_edit_clear, \
150 patch.object(self.form.last_name_edit, 'clear') as mocked_last_name_edit_clear, \
151 patch.object(self.form.display_edit, 'clear') as mocked_display_edit_clear, \
152 patch.object(self.form.first_name_edit, 'setFocus') as mocked_first_name_edit_setFocus:
153 # WHEN: The exec() method is called
154 self.form.exec(clear=True)
155
156 # THEN: The clear and exec() methods should have been called
157 mocked_first_name_edit_clear.assert_called_once_with()
158 mocked_last_name_edit_clear.assert_called_once_with()
159 mocked_display_edit_clear.assert_called_once_with()
160 mocked_first_name_edit_setFocus.assert_called_once_with()
161 mocked_exec.assert_called_once_with(self.form)
162
163 def test_first_name_edited(self):
164 """
165 Test the on_first_name_edited() method
166 """
167 # GIVEN: An author form
168 self.form.auto_display_name = True
169
170 with patch.object(self.form.last_name_edit, 'text') as mocked_last_name_edit_text, \
171 patch.object(self.form.display_edit, 'setText') as mocked_display_edit_setText:
172 mocked_last_name_edit_text.return_value = 'Newton'
173
174 # WHEN: on_first_name_edited() is called
175 self.form.on_first_name_edited('John')
176
177 # THEN: The display name should be updated
178 assert mocked_last_name_edit_text.call_count == 2
179 mocked_display_edit_setText.assert_called_once_with('John Newton')
180
181 def test_first_name_edited_no_auto(self):
182 """
183 Test the on_first_name_edited() method without auto_display_name
184 """
185 # GIVEN: An author form
186 self.form.auto_display_name = False
187
188 with patch.object(self.form.last_name_edit, 'text') as mocked_last_name_edit_text, \
189 patch.object(self.form.display_edit, 'setText') as mocked_display_edit_setText:
190
191 # WHEN: on_first_name_edited() is called
192 self.form.on_first_name_edited('John')
193
194 # THEN: The display name should not be updated
195 assert mocked_last_name_edit_text.call_count == 0
196 assert mocked_display_edit_setText.call_count == 0
197
198 def test_last_name_edited(self):
199 """
200 Test the on_last_name_edited() method
201 """
202 # GIVEN: An author form
203 self.form.auto_display_name = True
204
205 with patch.object(self.form.first_name_edit, 'text') as mocked_first_name_edit_text, \
206 patch.object(self.form.display_edit, 'setText') as mocked_display_edit_setText:
207 mocked_first_name_edit_text.return_value = 'John'
208
209 # WHEN: on_last_name_edited() is called
210 self.form.on_last_name_edited('Newton')
211
212 # THEN: The display name should be updated
213 assert mocked_first_name_edit_text.call_count == 2
214 mocked_display_edit_setText.assert_called_once_with('John Newton')
215
216 def test_last_name_edited_no_auto(self):
217 """
218 Test the on_last_name_edited() method without auto_display_name
219 """
220 # GIVEN: An author form
221 self.form.auto_display_name = False
222
223 with patch.object(self.form.first_name_edit, 'text') as mocked_first_name_edit_text, \
224 patch.object(self.form.display_edit, 'setText') as mocked_display_edit_setText:
225
226 # WHEN: on_last_name_edited() is called
227 self.form.on_last_name_edited('Newton')
228
229 # THEN: The display name should not be updated
230 assert mocked_first_name_edit_text.call_count == 0
231 assert mocked_display_edit_setText.call_count == 0
232
233 @patch('openlp.plugins.songs.forms.authorsform.critical_error_message_box')
234 def test_accept_no_first_name(self, mocked_critical_error):
235 """
236 Test the accept() method with no first name
237 """
238 # GIVEN: A form and no text in thefirst name edit
239 with patch.object(self.form.first_name_edit, 'text') as mocked_first_name_edit_text, \
240 patch.object(self.form.first_name_edit, 'setFocus') as mocked_first_name_edit_setFocus:
241 mocked_first_name_edit_text.return_value = ''
242
243 # WHEN: accept() is called
244 result = self.form.accept()
245
246 # THEN: The result should be false and a critical error displayed
247 assert result is False
248 mocked_critical_error.assert_called_once_with(message='You need to type in the first name of the author.')
249 mocked_first_name_edit_text.assert_called_once_with()
250 mocked_first_name_edit_setFocus.assert_called_once_with()
251
252 @patch('openlp.plugins.songs.forms.authorsform.critical_error_message_box')
253 def test_accept_no_last_name(self, mocked_critical_error):
254 """
255 Test the accept() method with no last name
256 """
257 # GIVEN: A form and no text in the last name edit
258 with patch.object(self.form.first_name_edit, 'text') as mocked_first_name_edit_text, \
259 patch.object(self.form.last_name_edit, 'text') as mocked_last_name_edit_text, \
260 patch.object(self.form.last_name_edit, 'setFocus') as mocked_last_name_edit_setFocus:
261 mocked_first_name_edit_text.return_value = 'John'
262 mocked_last_name_edit_text.return_value = ''
263
264 # WHEN: accept() is called
265 result = self.form.accept()
266
267 # THEN: The result should be false and a critical error displayed
268 assert result is False
269 mocked_critical_error.assert_called_once_with(message='You need to type in the last name of the author.')
270 mocked_first_name_edit_text.assert_called_once_with()
271 mocked_last_name_edit_text.assert_called_once_with()
272 mocked_last_name_edit_setFocus.assert_called_once_with()
273
274 @patch('openlp.plugins.songs.forms.authorsform.critical_error_message_box')
275 def test_accept_no_display_name_no_combine(self, mocked_critical_error):
276 """
277 Test the accept() method with no display name and no combining
278 """
279 # GIVEN: A form and no text in the display name edit
280 mocked_critical_error.return_value = QtWidgets.QMessageBox.No
281 with patch.object(self.form.first_name_edit, 'text') as mocked_first_name_edit_text, \
282 patch.object(self.form.last_name_edit, 'text') as mocked_last_name_edit_text, \
283 patch.object(self.form.display_edit, 'text') as mocked_display_edit_text, \
284 patch.object(self.form.display_edit, 'setFocus') as mocked_display_edit_setFocus:
285 mocked_first_name_edit_text.return_value = 'John'
286 mocked_last_name_edit_text.return_value = 'Newton'
287 mocked_display_edit_text.return_value = ''
288
289 # WHEN: accept() is called
290 result = self.form.accept()
291
292 # THEN: The result should be false and a critical error displayed
293 assert result is False
294 mocked_critical_error.assert_called_once_with(
295 message='You have not set a display name for the author, combine the first and last names?',
296 parent=self.form, question=True)
297 mocked_first_name_edit_text.assert_called_once_with()
298 mocked_last_name_edit_text.assert_called_once_with()
299 mocked_display_edit_text.assert_called_once_with()
300 mocked_display_edit_setFocus.assert_called_once_with()
301
302 @patch('openlp.plugins.songs.forms.authorsform.critical_error_message_box')
303 @patch('openlp.plugins.songs.forms.authorsform.QtWidgets.QDialog.accept')
304 def test_accept_no_display_name(self, mocked_accept, mocked_critical_error):
305 """
306 Test the accept() method with no display name and auto-combine
307 """
308 # GIVEN: A form and no text in the display name edit
309 mocked_accept.return_value = True
310 mocked_critical_error.return_value = QtWidgets.QMessageBox.Yes
311 with patch.object(self.form.first_name_edit, 'text') as mocked_first_name_edit_text, \
312 patch.object(self.form.last_name_edit, 'text') as mocked_last_name_edit_text, \
313 patch.object(self.form.display_edit, 'text') as mocked_display_edit_text, \
314 patch.object(self.form.display_edit, 'setText') as mocked_display_edit_setText:
315 mocked_first_name_edit_text.return_value = 'John'
316 mocked_last_name_edit_text.return_value = 'Newton'
317 mocked_display_edit_text.return_value = ''
318
319 # WHEN: accept() is called
320 result = self.form.accept()
321
322 # THEN: The result should be false and a critical error displayed
323 assert result is True
324 mocked_critical_error.assert_called_once_with(
325 message='You have not set a display name for the author, combine the first and last names?',
326 parent=self.form, question=True)
327 assert mocked_first_name_edit_text.call_count == 2
328 assert mocked_last_name_edit_text.call_count == 2
329 mocked_display_edit_text.assert_called_once_with()
330 mocked_display_edit_setText.assert_called_once_with('John Newton')
331 mocked_accept.assert_called_once_with(self.form)
332
333 @patch('openlp.plugins.songs.forms.authorsform.QtWidgets.QDialog.accept')
334 def test_accept(self, mocked_accept):
335 """
336 Test the accept() method
337 """
338 # GIVEN: A form and text in the right places
339 mocked_accept.return_value = True
340 with patch.object(self.form.first_name_edit, 'text') as mocked_first_name_edit_text, \
341 patch.object(self.form.last_name_edit, 'text') as mocked_last_name_edit_text, \
342 patch.object(self.form.display_edit, 'text') as mocked_display_edit_text:
343 mocked_first_name_edit_text.return_value = 'John'
344 mocked_last_name_edit_text.return_value = 'Newton'
345 mocked_display_edit_text.return_value = 'John Newton'
346
347 # WHEN: accept() is called
348 result = self.form.accept()
349
350 # THEN: The result should be false and a critical error displayed
351 assert result is True
352 mocked_first_name_edit_text.assert_called_once_with()
353 mocked_last_name_edit_text.assert_called_once_with()
354 mocked_display_edit_text.assert_called_once_with()
355 mocked_accept.assert_called_once_with(self.form)

Subscribers

People subscribed via source and target branches

to all changes: