def test_build_song_footer_base_songbook(self): """ Test build songs footer with basic song and multiple songbooks """ # GIVEN: A Song and a Service Item song = Song() song.title = 'My Song' song.alternate_title = '' song.copyright = 'My copyright' song.authors_songs = [] song.songbook_entries = [] song.alternate_title = '' song.topics = [] song.ccli_number = '' book1 = MagicMock() book1.name = 'My songbook' book2 = MagicMock() book2.name = 'Thy songbook' song.songbookentries = [] song.add_songbook_entry(book1, '12') song.add_songbook_entry(book2, '502A') service_item = ServiceItem(None) # WHEN: I generate the Footer with default settings self.media_item.generate_footer(service_item, song) # THEN: The songbook should be in the footer assert service_item.raw_footer == [ 'My Song', '© My copyright', 'My songbook #12, Thy songbook #502A' ]
def test_build_song_footer_base_songbook(self): """ Test build songs footer with basic song and multiple songbooks """ # GIVEN: A Song and a Service Item song = Song() song.title = 'My Song' song.copyright = 'My copyright' song.authors_songs = [] song.songbook_entries = [] song.ccli_number = '' book1 = MagicMock() book1.name = "My songbook" book2 = MagicMock() book2.name = "Thy songbook" song.songbookentries = [] song.add_songbook_entry(book1, '12') song.add_songbook_entry(book2, '502A') service_item = ServiceItem(None) # WHEN: I generate the Footer with default settings self.media_item.generate_footer(service_item, song) # THEN: The songbook should not be in the footer self.assertEqual(service_item.raw_footer, ['My Song', 'My copyright']) # WHEN: I activate the "display songbook" option self.media_item.display_songbook = True self.media_item.generate_footer(service_item, song) # THEN: The songbook should be in the footer self.assertEqual(service_item.raw_footer, ['My Song', 'My copyright', 'My songbook #12, Thy songbook #502A'])
def test_build_song_footer_base_songbook(self): """ Test build songs footer with basic song and multiple songbooks """ # GIVEN: A Song and a Service Item song = Song() song.title = 'My Song' song.copyright = 'My copyright' song.authors_songs = [] song.songbook_entries = [] song.ccli_number = '' book1 = MagicMock() book1.name = "My songbook" book2 = MagicMock() book2.name = "Thy songbook" song.songbookentries = [] song.add_songbook_entry(book1, '12') song.add_songbook_entry(book2, '502A') service_item = ServiceItem(None) # WHEN: I generate the Footer with default settings self.media_item.generate_footer(service_item, song) # THEN: The songbook should not be in the footer self.assertEqual(service_item.raw_footer, ['My Song', 'My copyright']) # WHEN: I activate the "display songbook" option self.media_item.display_songbook = True self.media_item.generate_footer(service_item, song) # THEN: The songbook should be in the footer self.assertEqual(service_item.raw_footer, ['My Song', 'My copyright', 'My songbook #12, Thy songbook #502A'])
def test_remove_author(self): """ Test removing an author from a song """ # GIVEN: A song with an author song = Song() song.authors_songs = [] author = Author() song.add_author(author) # WHEN: We remove the author song.remove_author(author) # THEN: It should have been removed self.assertEqual(0, len(song.authors_songs))
def test_remove_author(self): """ Test removing an author from a song """ # GIVEN: A song with an author song = Song() song.authors_songs = [] author = Author() song.add_author(author) # WHEN: We remove the author song.remove_author(author) # THEN: It should have been removed self.assertEqual(0, len(song.authors_songs))
def test_remove_author_with_type(self): """ Test removing an author with a type specified from a song """ # GIVEN: A song with two authors song = Song() song.authors_songs = [] author = Author() song.add_author(author) song.add_author(author, AuthorType.Translation) # WHEN: We remove the author with a certain type song.remove_author(author, AuthorType.Translation) # 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_remove_author_with_type(self): """ Test removing an author with a type specified from a song """ # GIVEN: A song with two authors song = Song() song.authors_songs = [] author = Author() song.add_author(author) song.add_author(author, AuthorType.Translation) # WHEN: We remove the author with a certain type song.remove_author(author, AuthorType.Translation) # 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_add_author_with_type(self): """ Test adding an author with a type specified to a song """ # GIVEN: A song and an author song = Song() song.authors_songs = [] author = Author() author.first_name = "Max" author.last_name = "Mustermann" # WHEN: We add an author to the song song.add_author(author, AuthorType.Words) # THEN: The author should have been added with author_type=None self.assertEqual(1, len(song.authors_songs)) self.assertEqual("Max", song.authors_songs[0].author.first_name) self.assertEqual("Mustermann", song.authors_songs[0].author.last_name) self.assertEqual(AuthorType.Words, song.authors_songs[0].author_type)
def test_add_author_with_type(self): """ Test adding an author with a type specified to a song """ # GIVEN: A song and an author song = Song() song.authors_songs = [] author = Author() author.first_name = "Max" author.last_name = "Mustermann" # WHEN: We add an author to the song song.add_author(author, AuthorType.Words) # THEN: The author should have been added with author_type=None self.assertEqual(1, len(song.authors_songs)) self.assertEqual("Max", song.authors_songs[0].author.first_name) self.assertEqual("Mustermann", song.authors_songs[0].author.last_name) self.assertEqual(AuthorType.Words, song.authors_songs[0].author_type)
def test_add_author(self): """ Test adding an author to a song """ # GIVEN: A song and an author song = Song() song.authors_songs = [] author = Author() author.first_name = "Max" author.last_name = "Mustermann" # WHEN: We add an author to the song song.add_author(author) # THEN: The author should have been added with author_type=None assert 1 == len(song.authors_songs) assert "Max" == song.authors_songs[0].author.first_name assert "Mustermann" == song.authors_songs[0].author.last_name assert song.authors_songs[0].author_type is None