From f13a9d00b5b2fe4ed5bd6a436075116f1b7e6063 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Wed, 24 Dec 2014 11:42:46 +0100 Subject: [PATCH 1/2] Missing translation type Fixes: https://launchpad.net/bugs/1405164 --- openlp/plugins/songs/lib/db.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/lib/db.py b/openlp/plugins/songs/lib/db.py index 3afba1b66..48ffe56bf 100644 --- a/openlp/plugins/songs/lib/db.py +++ b/openlp/plugins/songs/lib/db.py @@ -84,13 +84,15 @@ class AuthorType(object): NoType, Words, Music, - WordsAndMusic + WordsAndMusic, + Translation ] TranslatedTypes = [ Types[NoType], Types[Words], Types[Music], - Types[WordsAndMusic] + Types[WordsAndMusic], + Types[Translation] ] @staticmethod From c5d716f5653244bb9ebd171e54120ff238cd499a Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Wed, 24 Dec 2014 14:21:17 +0100 Subject: [PATCH 2/2] Test --- .../functional/openlp_plugins/songs/test_db.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/functional/openlp_plugins/songs/test_db.py b/tests/functional/openlp_plugins/songs/test_db.py index 690b89a18..ff496aec0 100644 --- a/tests/functional/openlp_plugins/songs/test_db.py +++ b/tests/functional/openlp_plugins/songs/test_db.py @@ -158,9 +158,9 @@ class TestDB(TestCase): # THEN: It should return only the name self.assertEqual("John Doe", display_name) - def test_author_get_display_name_with_type(self): + def test_author_get_display_name_with_type_words(self): """ - Test that the display name of an author with a type is correct + Test that the display name of an author with a type is correct (Words) """ # GIVEN: An author author = Author() @@ -172,6 +172,20 @@ class TestDB(TestCase): # THEN: It should return the name with the type in brackets self.assertEqual("John Doe (Words)", display_name) + def test_author_get_display_name_with_type_translation(self): + """ + Test that the display name of an author with a type is correct (Translation) + """ + # GIVEN: An author + author = Author() + author.display_name = "John Doe" + + # WHEN: We call the get_display_name() function + display_name = author.get_display_name(AuthorType.Translation) + + # THEN: It should return the name with the type in brackets + self.assertEqual("John Doe (Translation)", display_name) + def test_upgrade_old_song_db(self): """ Test that we can upgrade an old song db to the current schema