Fix the names of the songusage default settings

Fixes: https://launchpad.net/bugs/1532193
This commit is contained in:
Raoul Snyman 2017-02-02 18:39:59 -07:00
parent a0fb528ba7
commit ed8304bfb6
2 changed files with 29 additions and 4 deletions

View File

@ -44,9 +44,9 @@ if QtCore.QDate().currentDate().month() < 9:
__default_settings__ = {
'songusage/db type': 'sqlite',
'songusage/db username': '',
'songuasge/db password': '',
'songuasge/db hostname': '',
'songuasge/db database': '',
'songusage/db password': '',
'songusage/db hostname': '',
'songusage/db database': '',
'songusage/active': False,
'songusage/to date': QtCore.QDate(YEAR, 8, 31),
'songusage/from date': QtCore.QDate(YEAR - 1, 9, 1),

View File

@ -28,7 +28,7 @@ from unittest.mock import MagicMock, patch
from openlp.core import Registry
from openlp.plugins.songusage.lib import upgrade
from openlp.plugins.songusage.lib.db import init_schema
from openlp.plugins.songusage.songusageplugin import SongUsagePlugin
from openlp.plugins.songusage.songusageplugin import SongUsagePlugin, __default_settings__
class TestSongUsage(TestCase):
@ -81,3 +81,28 @@ class TestSongUsage(TestCase):
# THEN: It should return True
self.assertTrue(ret)
def test_default_settings(self):
"""
Test that all the default settings are correct
"""
# GIVEN: A list of default settings
expected_defaults = sorted([
'songusage/db type',
'songusage/db username',
'songusage/db password',
'songusage/db hostname',
'songusage/db database',
'songusage/active',
'songusage/to date',
'songusage/from date',
'songusage/last directory',
'songusage/last directory export',
'songusage/status'
])
# WHEN: The plugin is initialised
# THEN: The defaults should be correct
print(__default_settings__)
for e_key, a_key in zip(expected_defaults, sorted(__default_settings__.keys())):
assert e_key == a_key, '{} != {}'.format(e_key, a_key)