def test_album_save(self): self.album.save() for song in self.album.songs: artist = normalize(song.artist) album = normalize(song.album) title = normalize(song.title) path = os.path.join(os.path.expanduser("~"), 'Documents', 'LyricsMaster', artist, album, title + '.txt') assert os.path.exists(path) with codecs.open(path, 'r', encoding='utf-8') as file: assert song.lyrics == '\n'.join(file.readlines())
def test_song_save(self): self.song.save() path = os.path.join(os.path.expanduser("~"), 'Documents', 'LyricsMaster', normalize(real_singer['name']), normalize(real_singer['album']), 'Things-Done-Changed.txt') assert os.path.exists(path) folder = os.path.join(os.path.expanduser("~"), 'Documents', 'test_lyricsmaster_save') self.song.save(folder) path = os.path.join(folder, 'LyricsMaster', normalize(real_singer['name']), normalize(real_singer['album']), 'Things-Done-Changed.txt') assert os.path.exists(path) with codecs.open(path, 'r', encoding='utf-8') as file: assert self.song.lyrics == file.readlines()[0]