From 38b890cdd6d0187dba8244c9607d242757e77a8d Mon Sep 17 00:00:00 2001 From: Fabrice Laporte Date: Wed, 31 Dec 2014 06:16:06 +0100 Subject: [PATCH] lyrics: add test checking scraping of mocked page --- test/rsrc/lyricstext.yaml | 5 +++++ test/test_lyrics.py | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/test/rsrc/lyricstext.yaml b/test/rsrc/lyricstext.yaml index 70ce384fb..814c207df 100644 --- a/test/rsrc/lyricstext.yaml +++ b/test/rsrc/lyricstext.yaml @@ -1,3 +1,8 @@ +Beets_song: + - geeks + - bouquet + - panacea + Amsterdam: - oriflammes - fortune diff --git a/test/test_lyrics.py b/test/test_lyrics.py index 9374f99f5..492229630 100644 --- a/test/test_lyrics.py +++ b/test/test_lyrics.py @@ -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."""