Skip to content

Commit

Permalink
fixup! Improve setup of Tekstowo, Genius, Google scraping tests
Browse files Browse the repository at this point in the history
  • Loading branch information
snejus committed Sep 11, 2024
1 parent 143f73b commit dc02c94
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/plugins/test_lyrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,10 @@ def backend(self, backend_name):
return lyrics.LyricsPlugin().backends[backend_name]

@pytest.fixture
def lyrics_html(self, lyrics_root_dir, name):
return (lyrics_root_dir / f"{name}.txt").read_text()
def lyrics_html(self, lyrics_root_dir, file_name):
return (lyrics_root_dir / f"{file_name}.txt").read_text(
encoding="utf-8"
)

@pytest.mark.integration_test
def test_backend_source(self, backend):
Expand Down Expand Up @@ -254,7 +256,7 @@ def plugin_config(self):
return {"google_API_key": "test"}

@pytest.fixture(scope="class")
def name(self):
def file_name(self):
return "examplecom/beetssong"

@pytest.mark.integration_test
Expand Down Expand Up @@ -349,7 +351,7 @@ def backend_name(self):
return "genius"

@pytest.mark.parametrize(
"name, expected_line_count",
"file_name, expected_line_count",
[
("geniuscom/2pacalleyezonmelyrics", 134),
("geniuscom/Ttngchinchillalyrics", 29),
Expand All @@ -370,7 +372,7 @@ def backend_name(self):
return "tekstowo"

@pytest.mark.parametrize(
"name, query, should_scrape",
"file_name, query, should_scrape",
[
_p(
"tekstowopl/piosenka24kgoldncityofangels1",
Expand All @@ -385,7 +387,7 @@ def backend_name(self):
id="no-search-query-match",
),
_p(
"tekstowopl/piosenkabeethovenbeethovenpianosonata17tempestthe3rdmovement",
"tekstowopl/piosenkabeethovenbeethovenpianosonata17tempestthe3rdmovement", # noqa: E501
(
"Beethoven",
"Beethoven Piano Sonata 17 Tempest The 3rd Movement",
Expand All @@ -402,12 +404,12 @@ def test_scrape_tekstowo_lyrics(
assert actually_scraped == should_scrape

@pytest.mark.parametrize(
"name, expected_url",
"file_name, expected_url",
[
("tekstowopl/szukajwykonawcaagfdgjatytulagfdgafg", None),
(
"tekstowopl/szukajwykonawcajuicewrldtytulluciddreams",
"https://www.tekstowo.pl/piosenka,juice_wrld,lucid_dreams__remix__ft__lil_uzi_vert.html",
"https://www.tekstowo.pl/piosenka,juice_wrld,lucid_dreams__remix__ft__lil_uzi_vert.html", # noqa: E501
),
],
)
Expand Down

0 comments on commit dc02c94

Please sign in to comment.