Tidy beta landing page and qBittorrent status
This commit is contained in:
@@ -3,6 +3,7 @@ import tempfile
|
||||
import unittest
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
import httpx
|
||||
from fastapi import HTTPException
|
||||
from starlette.requests import Request
|
||||
|
||||
@@ -97,6 +98,19 @@ class NetworkSecurityTests(unittest.TestCase):
|
||||
|
||||
|
||||
class ServiceStatusTests(unittest.IsolatedAsyncioTestCase):
|
||||
async def test_qbittorrent_login_accepts_modern_empty_response_with_session_cookie(self) -> None:
|
||||
class FakeClient:
|
||||
def __init__(self) -> None:
|
||||
self.cookies = httpx.Cookies()
|
||||
|
||||
async def post(self, *_args, **_kwargs) -> httpx.Response:
|
||||
self.cookies.set("QBT_SID_8080", "session")
|
||||
return httpx.Response(204, request=httpx.Request("POST", "http://10.0.0.2:8080/api/v2/auth/login"))
|
||||
|
||||
client = status_router.QBittorrentClient("http://10.0.0.2:8080", "admin", "secret")
|
||||
|
||||
await client._login(FakeClient())
|
||||
|
||||
async def test_qbittorrent_incomplete_credentials_report_degraded_when_reachable(self) -> None:
|
||||
client = status_router.QBittorrentClient("http://10.0.0.2:8080", "admin", None)
|
||||
with patch.object(client, "is_webui_reachable", new=AsyncMock(return_value=True)):
|
||||
|
||||
Reference in New Issue
Block a user