removed not needed mocks and calls

This commit is contained in:
Andreas Preikschat 2013-04-08 20:30:11 +02:00
parent 352d8da185
commit d504b314ef

View File

@ -40,29 +40,25 @@ class TestEditCustomForm(TestCase):
""" """
Test the load_themes() method. Test the load_themes() method.
""" """
# GIVEN: A mocked QDialog.exec_() method # GIVEN: A theme list.
with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec: theme_list = [u'First Theme', u'Second Theme']
theme_list = [u'First Theme', u'Second Theme']
# WHEN: Show the dialog and add pass a theme list.
self.form.exec_()
self.form.load_themes(theme_list)
# THEN: There should be three items in the combo box. # WHEN: Show the dialog and add pass a theme list.
assert self.form.theme_combo_box.count() == 3, u'There should be three items (themes) in the combo box.' self.form.load_themes(theme_list)
# THEN: There should be three items in the combo box.
assert self.form.theme_combo_box.count() == 3, u'There should be three items (themes) in the combo box.'
def load_custom_test(self): def load_custom_test(self):
""" """
Test the load_custom() method. Test the load_custom() method.
""" """
# GIVEN: A mocked QDialog.exec_() method # WHEN: Create a new custom item.
with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec: self.form.load_custom(0)
# WHEN: Show the dialog and create a new custom item.
self.form.exec_()
self.form.load_custom(0)
# THEN: The line edits should not contain any text. # THEN: The line edits should not contain any text.
self.assertEqual(self.form.title_edit.text(), u'', u'The title edit should be empty') self.assertEqual(self.form.title_edit.text(), u'', u'The title edit should be empty')
self.assertEqual(self.form.credit_edit.text(), u'', u'The credit edit should be empty') self.assertEqual(self.form.credit_edit.text(), u'', u'The credit edit should be empty')
def on_add_button_clicked_test(self): def on_add_button_clicked_test(self):
@ -71,8 +67,8 @@ class TestEditCustomForm(TestCase):
""" """
# GIVEN: A mocked QDialog.exec_() method # GIVEN: A mocked QDialog.exec_() method
with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec: with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec:
# WHEN: Show the dialog and add a new slide. # WHEN: Add a new slide.
self.form.exec_()
QtTest.QTest.mouseClick(self.form.add_button, QtCore.Qt.LeftButton) QtTest.QTest.mouseClick(self.form.add_button, QtCore.Qt.LeftButton)
# THEN: One slide should be added. # THEN: One slide should be added.
assert self.form.slide_list_view.count() == 1, u'There should be one slide added.' assert self.form.slide_list_view.count() == 1, u'There should be one slide added.'