This commit is contained in:
Samuel Mehrbrodt 2014-07-17 23:16:00 +02:00
parent 2613ad3076
commit fa5787e5d8

View File

@ -125,3 +125,31 @@ class TestDB(TestCase):
# THEN: The type should be correct
self.assertEqual(author_type, AuthorType.Words)
def test_author_get_display_name(self):
"""
Test that the display name of an author is correct
"""
# GIVEN: An author
author = Author()
author.display_name = "John Doe"
# WHEN: We call the get_display_name() function
display_name = author.get_display_name()
# THEN: It should return only the name
self.assertEqual("John Doe", display_name)
def test_author_get_display_name_with_type(self):
"""
Test that the display name of an author with a type is correct
"""
# 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.Words)
# THEN: It should return the name with the type in brackets
self.assertEqual("John Doe (Words)", display_name)