✨ Champ port optionnel (Radarr + qBittorrent) et normalisation des adresses locales
This commit is contained in:
1 parent
f0b5f2b21e
commit
76dbd7e425
6 files changed
+127
-35
No files matched your search
+20
-5
@@ -76,19 +76,27 @@ def test_scan_only_imports_iso_files() -> None:
|
||||
|
||||
|
||||
@respx.mock
|
||||
def test_qbittorrent_connection() -> None:
|
||||
respx.post("http://qbit:8080/api/v2/auth/login").mock(
|
||||
def test_qbittorrent_connection_local_address_with_port() -> None:
|
||||
# Adresse locale sans schema + port separe: l'URL de base doit etre
|
||||
# reconstruite en http://192.168.1.50:8080.
|
||||
respx.post("http://192.168.1.50:8080/api/v2/auth/login").mock(
|
||||
return_value=Response(200, text="Ok.")
|
||||
)
|
||||
respx.get("http://qbit:8080/api/v2/app/version").mock(
|
||||
respx.get("http://192.168.1.50:8080/api/v2/app/version").mock(
|
||||
return_value=Response(200, text="v5.0.2")
|
||||
)
|
||||
with TestClient(app) as client:
|
||||
response = client.put(
|
||||
"/api/settings/qbittorrent",
|
||||
json={"url": "http://qbit:8080", "username": "admin", "password": "pass"},
|
||||
json={
|
||||
"url": "192.168.1.50",
|
||||
"port": 8080,
|
||||
"username": "admin",
|
||||
"password": "pass",
|
||||
},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert response.json()["port"] == 8080
|
||||
test = client.post("/api/settings/qbittorrent/test")
|
||||
assert test.status_code == 200
|
||||
assert test.json()["version"] == "v5.0.2"
|
||||
@@ -98,13 +106,20 @@ def test_settings_persist_to_conf_json() -> None:
|
||||
with TestClient(app) as client:
|
||||
put = client.put(
|
||||
"/api/settings/qbittorrent",
|
||||
json={"url": "http://qbit:8080/", "username": "admin", "password": "pass"},
|
||||
json={
|
||||
"url": "http://qbit:8080/",
|
||||
"port": 8080,
|
||||
"username": "admin",
|
||||
"password": "pass",
|
||||
},
|
||||
)
|
||||
got = client.get("/api/settings/qbittorrent")
|
||||
assert put.status_code == 200
|
||||
assert put.json()["password_configured"] is True
|
||||
assert got.json()["url"] == "http://qbit:8080"
|
||||
assert got.json()["port"] == 8080
|
||||
raw = json.loads(config_path().read_text(encoding="utf-8"))
|
||||
assert raw["qbittorrent"]["url"] == "http://qbit:8080"
|
||||
assert raw["qbittorrent"]["port"] == 8080
|
||||
assert raw["qbittorrent"]["username"] == "admin"
|
||||
assert raw["qbittorrent"]["password"] == "pass"
|
||||
Reference in new issue
Block a user