🛡️ | Fix security hotspot - replace /tmp path with tmp_path
All checks were successful
SonarQube Code Quality Scan / SonarQube Scan (push) Successful in 1m51s
All checks were successful
SonarQube Code Quality Scan / SonarQube Scan (push) Successful in 1m51s
This commit is contained in:
@@ -468,12 +468,14 @@ class TestAudioPlayer:
|
|||||||
assert isinstance(task_id, int)
|
assert isinstance(task_id, int)
|
||||||
assert song["videoId"] == "prefetch_test"
|
assert song["videoId"] == "prefetch_test"
|
||||||
|
|
||||||
def test_on_download_succeeded_prefetch(self, player):
|
def test_on_download_succeeded_prefetch(self, player, tmp_path):
|
||||||
"""_on_download_succeeded caches prefetch result."""
|
"""_on_download_succeeded caches prefetch result."""
|
||||||
|
temp_file = tmp_path / "test.mp3"
|
||||||
|
temp_file.write_text("audio")
|
||||||
player._prefetch_task_id = 55
|
player._prefetch_task_id = 55
|
||||||
player._queue = [{"videoId": "prefetch_vid"}]
|
player._queue = [{"videoId": "prefetch_vid"}]
|
||||||
player._on_download_succeeded(55, {"videoId": "prefetch_vid",
|
player._on_download_succeeded(55, {"videoId": "prefetch_vid",
|
||||||
"_local_path": "/tmp/test.mp3"})
|
"_local_path": str(temp_file)})
|
||||||
assert "prefetch_vid" in player._prefetch_cache
|
assert "prefetch_vid" in player._prefetch_cache
|
||||||
assert player._prefetch_task_id is None
|
assert player._prefetch_task_id is None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user