forked from openlp/openlp
Add test
This commit is contained in:
parent
5d7b60f714
commit
8e8288ddaa
@ -104,7 +104,7 @@ class AuthorType(object):
|
||||
for key, value in AuthorType.Types.items():
|
||||
if value == translated_type:
|
||||
return key
|
||||
return None
|
||||
return AuthorType.NoType
|
||||
|
||||
|
||||
class Book(BaseModel):
|
||||
|
@ -112,3 +112,16 @@ class TestDB(TestCase):
|
||||
# THEN: It should have been removed and the other author should still be there
|
||||
self.assertEqual(1, len(song.authors_songs))
|
||||
self.assertEqual(None, song.authors_songs[0].author_type)
|
||||
|
||||
def test_get_author_type_from_translated_text(self):
|
||||
"""
|
||||
Test getting an author type from translated text
|
||||
"""
|
||||
# GIVEN: A string with an author type
|
||||
author_type_name = AuthorType.Types[AuthorType.Words]
|
||||
|
||||
# WHEN: We call the method
|
||||
author_type = AuthorType.from_translated_text(author_type_name)
|
||||
|
||||
# THEN: The type should be correct
|
||||
self.assertEqual(author_type, AuthorType.Words)
|
||||
|
Loading…
Reference in New Issue
Block a user