torrent and platform_ops unit tests now passing

This commit is contained in:
Microchip
2026-09-26 14:25:45 -04:00
parent 82f9342918
commit 919145569a
4 changed files with 1172 additions and 108 deletions
+2
View File
@@ -8,6 +8,8 @@ import hashlib
import platform
#from .config import APP_DATA_DIR, DOWNLOAD_TIMEOUT, ensure_dir
from .app_log import log
from .net import secure_urlopen
import urllib.request
# NOTE: Creates dir and verifies it was made
+1162 -100
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -23,7 +23,7 @@ def test_ensure_aria2c_returns_existing_executable(monkeypatch):
installer = Mock()
monkeypatch.setattr(
torrent.platform_ops,
torrent,
"install_aria2c_windows",
installer,
)
@@ -58,7 +58,7 @@ def test_ensure_aria2c_installs_when_not_found(monkeypatch):
)
monkeypatch.setattr(
torrent.platform_ops,
torrent,
"install_aria2c_windows",
installer,
)
@@ -86,7 +86,7 @@ def test_ensure_aria2c_passes_custom_logger(monkeypatch):
)
monkeypatch.setattr(
torrent.platform_ops,
torrent,
"install_aria2c_windows",
installer,
)
@@ -114,7 +114,7 @@ def test_ensure_aria2c_empty_path_triggers_install(monkeypatch):
)
monkeypatch.setattr(
torrent.platform_ops,
torrent,
"install_aria2c_windows",
installer,
)
@@ -133,7 +133,7 @@ def test_ensure_aria2c_propagates_installer_failure(monkeypatch):
)
monkeypatch.setattr(
torrent.platform_ops,
torrent,
"install_aria2c_windows",
Mock(
side_effect=RuntimeError(
+3 -3
View File
@@ -12,7 +12,7 @@ from .app_log import log
from .config import APP_DATA_DIR, UA, DOWNLOAD_TIMEOUT
from .mods import MODS_REGISTRY
from .net import ALLOWED_DOWNLOAD_HOSTS, secure_urlopen
from .platform_ops import create_directory_link, ensure_dir
from .platform_ops import create_directory_link, ensure_dir, find_aria2c, install_aria2c_windows
CLIENT_TORRENT_URL = "https://dl.octowow.st/download/client.torrent"
@@ -35,9 +35,9 @@ def ensure_aria2c(log_fn=log) -> str:
return platform_ops.install_aria2c_windows( APP_DATA_DIR=APP_DATA_DIR,
return install_aria2c_windows( APP_DATA_DIR=APP_DATA_DIR,
ALLOWED_DOWNLOAD_HOSTS=ALLOWED_DOWNLOAD_HOSTS,
log_fn=log)
log_fn=log_fn)
def _bdecode(buf: bytes, pos: int = 0):