diff --git a/openlp/.version b/openlp/.version index 35cee72dc..79a614418 100644 --- a/openlp/.version +++ b/openlp/.version @@ -1 +1 @@ -2.4.3 +2.4.4 diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 8cecbe0af..b50840558 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -126,7 +126,7 @@ class BibleManager(RegistryProperties): name = bible.get_name() # Remove corrupted files. if name is None: - bible.session.close() + bible.session.close_all() delete_file(os.path.join(self.path, filename)) continue log.debug('Bible Name: "%s"', name) @@ -173,7 +173,7 @@ class BibleManager(RegistryProperties): """ log.debug('BibleManager.delete_bible("%s")', name) bible = self.db_cache[name] - bible.session.close() + bible.session.close_all() bible.session = None return delete_file(os.path.join(bible.path, bible.file)) diff --git a/resources/i18n/af.ts b/resources/i18n/af.ts index 8f4418ee4..e0c97e828 100644 --- a/resources/i18n/af.ts +++ b/resources/i18n/af.ts @@ -1288,7 +1288,7 @@ Dit is nie moontlik om die Boek Name aan te pas nie. An error occurred while downloading the list of bibles from %s. - + Daar was 'n probleem om die lys van Bybels af te laai vanaf %s. @@ -1429,7 +1429,7 @@ Hierdie Bybel sal weer ingevoer moet word voordat dit gebruik geneem kan word. Incorrect Bible file type supplied. This looks like a Zefania XML bible, please use the Zefania import option. - + Ongeldige Bybel lêertipe verskaf. Hierdie lyk soos 'n Zefania XML Bybel, gebruik asseblief die Zefania invoer opsie. @@ -1437,7 +1437,7 @@ Hierdie Bybel sal weer ingevoer moet word voordat dit gebruik geneem kan word. Importing %(bookname)s %(chapter)s... - + Invoer %(bookname)s %(chapter)s... @@ -1445,12 +1445,12 @@ Hierdie Bybel sal weer ingevoer moet word voordat dit gebruik geneem kan word. Removing unused tags (this may take a few minutes)... - + Verwydering van ongebruikte tags (dit mag 'n paar minuute neem)... Importing %(bookname)s %(chapter)s... - + Invoer %(bookname)s %(chapter)s... @@ -1599,7 +1599,8 @@ Volledig Upgrading Bible(s): %(success)d successful%(failed_text)s Please note that verses from Web Bibles will be downloaded on demand and so an Internet connection is required. - + Opgradeer Bybel(s): %(success)d suksesvol %(failed_text)s +Neem kennis dat verse van Web Bybels op aanvraag afgelaai word en dus is 'n Internet verbinding nodig. @@ -1607,7 +1608,7 @@ Please note that verses from Web Bibles will be downloaded on demand and so an I Incorrect Bible file type supplied. Zefania Bibles may be compressed. You must decompress them before import. - + Ongeldige Bybel lêertipe verskaf. Zefania Bybels mag dalk saamgeperste lêers wees. Jy moet hulle eers ontpers voordat hulle ingevoer word. @@ -1615,7 +1616,7 @@ Please note that verses from Web Bibles will be downloaded on demand and so an I Importing %(bookname)s %(chapter)s... - + Invoer %(bookname)s %(chapter)s... @@ -1681,7 +1682,7 @@ Please note that verses from Web Bibles will be downloaded on demand and so an I <strong>Custom Slide Plugin </strong><br />The custom slide plugin provides the ability to set up custom text slides that can be displayed on the screen the same way songs are. This plugin provides greater freedom over the songs plugin. - + <strong>Aanpas Skyfie Mini-program</strong><br/>Die aanpas skyfie mini-program verskaf die vermoë om aangepasde teks skyfies op te stel wat in dieselfde manier gebruik word as die liedere mini-program. Dié mini-program verskaf grooter vryheid as die liedere mini-program. @@ -1699,7 +1700,7 @@ Please note that verses from Web Bibles will be downloaded on demand and so an I Import missing custom slides from service files - + Voer vermisde aangepasde skyfies in vanaf diens lêers @@ -1762,7 +1763,7 @@ Please note that verses from Web Bibles will be downloaded on demand and so an I You need to add at least one slide. - + Ten minste een skyfie moet bygevoeg word @@ -1778,7 +1779,7 @@ Please note that verses from Web Bibles will be downloaded on demand and so an I Are you sure you want to delete the "%d" selected custom slide(s)? - + Wis sekerlik die %d gekose aangepasde skyfie(s) uit? @@ -1847,32 +1848,32 @@ Please note that verses from Web Bibles will be downloaded on demand and so an I Add group - + Voeg groep by Parent group: - + Ouer groep: Group name: - + Groep naam: You need to type in a group name. - + 'n Groep naam moet ingevoer word. Could not add the new group. - + Nuwe groep kon nie bygevoeg word nie. This group already exists. - + Hierdie groep bestaan reeds. @@ -1880,27 +1881,27 @@ Please note that verses from Web Bibles will be downloaded on demand and so an I Select Image Group - + Selekteer Beeld Groep Add images to group: - + Voeg beelde by groep: No group - + Geen groep Existing group - + Reeds bestaande groep New group - + Nuwe groep @@ -1953,22 +1954,22 @@ Voeg steeds die ander beelde by? -- Top-level group -- - + -- Boonste vlak groep -- You must select an image or group to delete. - + Of 'n beeld of 'n groep om uit te wis moet geselekteer word. Remove group - + Verwyder groep Are you sure you want to remove "%s" and everything in it? - + Verwyder sekerlik "%s" en alles wat daarin is? @@ -1984,27 +1985,27 @@ Voeg steeds die ander beelde by? Audio - + Oudio Video - + Video VLC is an external player which supports a number of different formats. - + VLC is 'n eksterne speler wat 'n aantal verskillende formate ondersteun. Webkit is a media player which runs inside a web browser. This player allows text over video to be rendered. - + WebKit is 'n media-speler wat loop in 'n webblaaier. Hierdie speler toelaat teks oor video gelewer moet word. This media player uses your operating system to provide media capabilities. - + Hierdie media-speler gebruik jou bedryfstelsel om media vermoëns. @@ -2073,32 +2074,32 @@ Voeg steeds die ander beelde by? Select Media Clip - + Selekteer Media Gedeelte Source - + Bron Media path: - + Media pad: Select drive from list - + Selekteer skyf vanaf lys Load disc - + Laai skyf Track Details - + Snit Inligting @@ -2108,52 +2109,52 @@ Voeg steeds die ander beelde by? Audio track: - + Oudio snit: Subtitle track: - + Subtitel snit: HH:mm:ss.z - + HH:mm:ss.z Clip Range - + Gedeelte Omvang Start point: - + Begin punt: Set start point - + Stel begin punt Jump to start point - + Spring na begin punt End point: - + Eindpunt: Set end point - + Stel eindpunt Jump to end point - + Spring na eindpunt @@ -2161,67 +2162,67 @@ Voeg steeds die ander beelde by? No path was given - + Geen pad gegee Given path does not exists - + Gegewe pad bestaan nie An error happened during initialization of VLC player - + 'n Fout het gebeur tydens inisialisering van VLC speler VLC player failed playing the media - + VLC speler versuim om die media te speel CD not loaded correctly - + CD nie korrek gelaai nie The CD was not loaded correctly, please re-load and try again. - + Die CD was nie korrek gelaai nie, laai weer en probeer weer asseblief. DVD not loaded correctly - + DVD nie korrek gelaai nie The DVD was not loaded correctly, please re-load and try again. - + Die DVD was nie korrek gelaai nie, laai weer en probeer weer asseblief. Set name of mediaclip - + Stel naam van media gedeelte Name of mediaclip: - + Naam van media gedeelte: Enter a valid name or cancel - + Gee 'n geldige naam of kanselleer Invalid character - + Ongeldige karakter The name of the mediaclip must not contain the character ":" - + Die naam van die media gedeelta mag nie die ":" karakter bevat nie @@ -2279,37 +2280,37 @@ Voeg steeds die ander beelde by? VLC player required - + VLC speler vereis VLC player required for playback of optical devices - + VLC speler is vir die speel van optiese toestelle nodig Load CD/DVD - + Laai CD/DVD Load CD/DVD - only supported when VLC is installed and enabled - + Laai CD/DVD - net ondersteun wanneer VLC geïnstalleer en geaktiveer is The optical disc %s is no longer available. - + Die optiese skyf %s is nie meer beskikbaar nie Mediaclip already saved - + Media gedeelte alreeds gestoor This mediaclip has already been saved - + Hierdie media gedeelte is alreeds gestoor @@ -2322,7 +2323,7 @@ Voeg steeds die ander beelde by? Start Live items automatically - + Begin regstreeks items automaties @@ -2330,7 +2331,7 @@ Voeg steeds die ander beelde by? &Projector Manager - + Projektor Bestuurder @@ -2943,7 +2944,7 @@ Hierdie ligging sal gebruik word nadat OpenLP toegemaak is. Video - + Video @@ -4173,7 +4174,7 @@ Die nuutste weergawe kan afgelaai word vanaf http://openlp.org/. English Please add the name of your language here - Engels + Afrikaans @@ -7004,7 +7005,7 @@ These files will be removed if you continue to save. Add group - + Voeg groep by diff --git a/tests/functional/openlp_plugins/bibles/test_manager.py b/tests/functional/openlp_plugins/bibles/test_manager.py new file mode 100644 index 000000000..d18d3cfc6 --- /dev/null +++ b/tests/functional/openlp_plugins/bibles/test_manager.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2016 OpenLP Developers # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### +""" +This module contains tests for the manager submodule of the Bibles plugin. +""" +from unittest import TestCase +from unittest.mock import MagicMock, patch + +from openlp.plugins.bibles.lib.manager import BibleManager + + +class TestManager(TestCase): + """ + Test the functions in the :mod:`manager` module. + """ + + def setUp(self): + app_location_patcher = patch('openlp.plugins.bibles.lib.manager.AppLocation') + self.addCleanup(app_location_patcher.stop) + app_location_patcher.start() + log_patcher = patch('openlp.plugins.bibles.lib.manager.log') + self.addCleanup(log_patcher.stop) + self.mocked_log = log_patcher.start() + settings_patcher = patch('openlp.plugins.bibles.lib.manager.Settings') + self.addCleanup(settings_patcher.stop) + settings_patcher.start() + + def test_delete_bible(self): + """ + Test the BibleManager delete_bible method + """ + # GIVEN: An instance of BibleManager and a mocked bible + with patch.object(BibleManager, 'reload_bibles'), \ + patch('openlp.plugins.bibles.lib.manager.os.path.join', side_effect=lambda x, y: '{}/{}'.format(x, y)),\ + patch('openlp.plugins.bibles.lib.manager.delete_file', return_value=True) as mocked_delete_file: + instance = BibleManager(MagicMock()) + # We need to keep a reference to the mock for close_all as it gets set to None later on! + mocked_close_all = MagicMock() + mocked_bible = MagicMock(file='KJV.sqlite', path='bibles', **{'session.close_all': mocked_close_all}) + instance.db_cache = {'KJV': mocked_bible} + + # WHEN: Calling delete_bible with 'KJV' + result = instance.delete_bible('KJV') + + # THEN: The session should have been closed and set to None, the bible should be deleted, and the result of + # the deletion returned. + self.assertTrue(result) + mocked_close_all.assert_called_once_with() + self.assertIsNone(mocked_bible.session) + mocked_delete_file.assert_called_once_with('bibles/KJV.sqlite') diff --git a/tests/utils/test_bzr_tags.py b/tests/utils/test_bzr_tags.py index 3071b3e27..2facc710f 100644 --- a/tests/utils/test_bzr_tags.py +++ b/tests/utils/test_bzr_tags.py @@ -29,7 +29,7 @@ from subprocess import Popen, PIPE TAGS1 = {'1.9.0', '1.9.1', '1.9.2', '1.9.3', '1.9.4', '1.9.5', '1.9.6', '1.9.7', '1.9.8', '1.9.9', '1.9.10', '1.9.11', '1.9.12', '2.0', '2.1.0', '2.1.1', '2.1.2', '2.1.3', '2.1.4', '2.1.5', '2.1.6', '2.2', - '2.3.1', '2.3.2', '2.3.3', '2.4', '2.4.1', '2.4.2', '2.4.3'} + '2.3.1', '2.3.2', '2.3.3', '2.4', '2.4.1', '2.4.2', '2.4.3', '2.4.4'} class TestBzrTags(TestCase):