-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add -s <search_term> command line argument
- Loading branch information
1 parent
091596c
commit 4bf0002
Showing
2 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
from tests.utils import assert_track, call_scdl_with_auth | ||
|
||
|
||
def test_search(tmp_path: Path) -> None: | ||
os.chdir(tmp_path) | ||
r = call_scdl_with_auth( | ||
"-s", | ||
"7x11x13-testing test track", | ||
"--name-format", | ||
"track", | ||
"--onlymp3", | ||
) | ||
assert r.returncode == 0 | ||
assert_track(tmp_path, "track.mp3") | ||
|
||
|
||
def test_search_no_results(tmp_path: Path) -> None: | ||
os.chdir(tmp_path) | ||
r = call_scdl_with_auth( | ||
"-s", | ||
"this query should not return any results xyzabc123", | ||
"--name-format", | ||
"track", | ||
"--onlymp3", | ||
) | ||
assert r.returncode == 1 | ||
assert "No results found for query" in r.stderr | ||
|
||
|
||
def test_search_playlist(tmp_path: Path) -> None: | ||
os.chdir(tmp_path) | ||
r = call_scdl_with_auth( | ||
"-s", | ||
"playlist1 7x11x13-testing", | ||
"--playlist-name-format", | ||
"{playlist[tracknumber]}_{title}", | ||
"--onlymp3", | ||
) | ||
assert r.returncode == 0 | ||
assert_track(tmp_path / "playlist1", "1_OK Bye.mp3", check_metadata=False) | ||
assert_track(tmp_path / "playlist1", "2_Wan Bushi - Eurodance Vibes (part 1+2+3).mp3", check_metadata=False) |