lyrics: add test checking scraping of mocked page

This commit is contained in:
Fabrice Laporte 2014-12-31 06:16:06 +01:00
parent c34e718ab6
commit 38b890cdd6
2 changed files with 14 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Beets_song:
- geeks
- bouquet
- panacea
Amsterdam:
- oriflammes
- fortune

View file

@ -300,6 +300,15 @@ class LyricsGooglePluginTest(unittest.TestCase):
lyrics.LyricsPlugin()
lyrics.fetch_url = MockFetchUrl()
def test_mocked_source_ok(self):
"""Test that lyrics of the mocked page are correctly scraped"""
url = self.source['url'] + self.source['path']
if os.path.isfile(url_to_filename(url)):
res = lyrics.scrape_lyrics_from_html(lyrics.fetch_url(url))
self.assertTrue(lyrics.is_lyrics(res), url)
self.assertTrue(is_lyrics_content_ok(self.source['title'], res),
url)
def test_google_sources_ok(self):
"""Test if lyrics present on websites registered in beets google custom
search engine are correctly scraped."""