def test_on_volunteer_button_clicked(self, mocked_webbrowser): """ Test that clicking on the "Volunteer" button opens a web page. """ # GIVEN: A new About dialog and a mocked out webbrowser module about_form = AboutForm(None) # WHEN: The "Volunteer" button is "clicked" about_form.on_volunteer_button_clicked() # THEN: A web browser is opened mocked_webbrowser.open_new.assert_called_with('http://openlp.org/en/contribute')
def test_on_volunteer_button_clicked(self): """ Test that clicking on the "Volunteer" button opens a web page. """ # GIVEN: A new About dialog and a mocked out webbrowser module with patch('openlp.core.ui.aboutform.webbrowser') as mocked_webbrowser: about_form = AboutForm(None) # WHEN: The "Volunteer" button is "clicked" about_form.on_volunteer_button_clicked() # THEN: A web browser is opened mocked_webbrowser.open_new.assert_called_with('http://openlp.org/en/contribute')
def test_about_form_build_number(self, mocked_get_version): """ Test that the build number is added to the about form """ # GIVEN: A mocked out get_version function mocked_get_version.return_value = {'version': '3.1.5', 'build': '3000'} # WHEN: The about form is created about_form = AboutForm(None) # THEN: The build number should be in the text assert 'OpenLP 3.1.5 build 3000' in about_form.about_text_edit.toPlainText(), \ "The build number should be set correctly"
def test_about_form_date(self): """ Test that the copyright date is included correctly """ # GIVEN: A correct application date date_string = "2004-%s" % datetime.date.today().year # WHEN: The about form is created about_form = AboutForm(None) license_text = about_form.license_text_edit.toPlainText() # THEN: The date should be in the text twice. assert license_text.count(date_string, 0) == 2, "The text string should be added twice to the license string"