feat: Add authenticated service checks
Support FreshRSS login with challenge hashing, add GitHub token usage, and update service metadata for Immich and PeerTube.
This commit is contained in:
parent
95cd8e0906
commit
7537de2f53
11 changed files with 257 additions and 59 deletions
39
tests/test_versions_end_to_end.py
Normal file
39
tests/test_versions_end_to_end.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import sys
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
sys.path.append(str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
from check_updates import check_service, load_services
|
||||
|
||||
|
||||
def test_services_extract_current_and_latest():
|
||||
services = load_services(
|
||||
{
|
||||
"services": [
|
||||
{
|
||||
"name": "CurrentVersion",
|
||||
"base_url": "https://example.com/",
|
||||
"current_version_url": "https://example.com/current",
|
||||
"current_version_extract": {"type": "jsonpath", "value": "$.version"},
|
||||
"upstream_latest_version_url": "https://example.com/latest",
|
||||
"upstream_latest_extract": {"type": "jsonpath", "value": "$.tag"},
|
||||
}
|
||||
]
|
||||
}
|
||||
)
|
||||
|
||||
responses = {
|
||||
"https://example.com/current": "{\"version\": \"1.2.3\"}",
|
||||
"https://example.com/latest": "{\"tag\": \"1.2.4\"}",
|
||||
}
|
||||
|
||||
def fake_fetch(url, _timeout, _user_agent, _headers=None, _data=None, _method="GET"):
|
||||
return responses[url], {}
|
||||
|
||||
service = list(services.values())[0]
|
||||
with patch("check_updates.fetch_response", side_effect=fake_fetch):
|
||||
result = check_service(service, timeout=5, user_agent="test")
|
||||
|
||||
assert result["current"] == "1.2.3"
|
||||
assert result["latest"] == "1.2.4"
|
||||
Loading…
Add table
Add a link
Reference in a new issue