remove REVIEW.md from repo
This commit is contained in:
+16
-15
@@ -23,7 +23,7 @@ import tempfile
|
||||
import threading
|
||||
import time
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List, Optional
|
||||
from typing import Any
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
# ── Mock heavy dependencies before any webui_server import ─────────────
|
||||
@@ -51,8 +51,8 @@ os.environ["TELEGRAM_SCRAPER_PORT"] = "0"
|
||||
os.environ["TELEGRAM_SCRAPER_START_CONTINUOUS"] = "0"
|
||||
|
||||
# Now safe to import app modules
|
||||
import app_state # noqa: E402
|
||||
from app_state import ( # noqa: E402
|
||||
import app_state
|
||||
from app_state import (
|
||||
ACCOUNT_DEFAULTS,
|
||||
account_data_dir,
|
||||
account_exists,
|
||||
@@ -62,7 +62,7 @@ from app_state import ( # noqa: E402
|
||||
list_accounts,
|
||||
load_account,
|
||||
)
|
||||
from health import health_payload # noqa: E402
|
||||
from health import health_payload
|
||||
|
||||
|
||||
def _init_test_env():
|
||||
@@ -82,14 +82,14 @@ def make_account_id() -> str:
|
||||
return f"test-{int(time.time() * 1000000)}"
|
||||
|
||||
|
||||
def create_account(data_dir: Path, account_id: str, **overrides) -> Dict[str, Any]:
|
||||
def create_account(data_dir: Path, account_id: str, **overrides) -> dict[str, Any]:
|
||||
store = get_account_store(data_dir, account_id)
|
||||
state = dict(ACCOUNT_DEFAULTS)
|
||||
state.update(overrides)
|
||||
state["label"] = overrides.get("label", account_id)
|
||||
store.save(state)
|
||||
|
||||
def mutate(g: Dict[str, Any]) -> None:
|
||||
def mutate(g: dict[str, Any]) -> None:
|
||||
accounts = g.setdefault("accounts", [])
|
||||
if account_id not in accounts:
|
||||
accounts.append(account_id)
|
||||
@@ -98,7 +98,7 @@ def create_account(data_dir: Path, account_id: str, **overrides) -> Dict[str, An
|
||||
return load_account(data_dir, account_id)
|
||||
|
||||
|
||||
def create_channel_db(data_dir: Path, account_id: Optional[str], channel_id: str, messages: List[Dict[str, Any]]) -> None:
|
||||
def create_channel_db(data_dir: Path, account_id: str | None, channel_id: str, messages: list[dict[str, Any]]) -> None:
|
||||
if account_id:
|
||||
db_dir = account_data_dir(data_dir, account_id) / channel_id
|
||||
else:
|
||||
@@ -378,7 +378,7 @@ class TestContinuousOrchestrator:
|
||||
|
||||
def test_does_not_auto_start_on_import(self):
|
||||
"""Importing an account must not trigger continuous scraping."""
|
||||
PerAccountContinuousScrapeManager, ContinuousScrapeOrchestrator, ws = self._import_orch_classes()
|
||||
_PerAccountContinuousScrapeManager, ContinuousScrapeOrchestrator, _ws = self._import_orch_classes()
|
||||
self._setup_ws_data_dir()
|
||||
try:
|
||||
orch = ContinuousScrapeOrchestrator()
|
||||
@@ -394,7 +394,7 @@ class TestContinuousOrchestrator:
|
||||
|
||||
def test_no_duplicate_workers_on_same_account(self):
|
||||
"""Multiple start() calls should not spawn duplicate threads."""
|
||||
PerAccountContinuousScrapeManager, _, ws = self._import_orch_classes()
|
||||
PerAccountContinuousScrapeManager, _, _ws = self._import_orch_classes()
|
||||
self._setup_ws_data_dir()
|
||||
try:
|
||||
aid = make_account_id()
|
||||
@@ -424,7 +424,7 @@ class TestContinuousOrchestrator:
|
||||
|
||||
def test_disabled_account_not_started(self):
|
||||
"""start_all() must not start accounts with enabled=False."""
|
||||
_, ContinuousScrapeOrchestrator, ws = self._import_orch_classes()
|
||||
_, ContinuousScrapeOrchestrator, _ws = self._import_orch_classes()
|
||||
self._setup_ws_data_dir()
|
||||
try:
|
||||
orch = ContinuousScrapeOrchestrator()
|
||||
@@ -442,7 +442,7 @@ class TestContinuousOrchestrator:
|
||||
"""stop()+join() must let status['running'] become False only after the
|
||||
worker thread truly exits, and join must be safe/idempotent on a
|
||||
short-lived thread."""
|
||||
PerAccountContinuousScrapeManager, _, ws = self._import_orch_classes()
|
||||
PerAccountContinuousScrapeManager, _, _ws = self._import_orch_classes()
|
||||
self._setup_ws_data_dir()
|
||||
try:
|
||||
aid = make_account_id()
|
||||
@@ -479,7 +479,7 @@ class TestContinuousOrchestrator:
|
||||
def test_refresh_config_disable_requests_stop_without_lying_about_running(self):
|
||||
"""refresh_config() disabling the account must request a stop but must
|
||||
NOT set status['running']=False (the worker thread owns that)."""
|
||||
PerAccountContinuousScrapeManager, _, ws = self._import_orch_classes()
|
||||
PerAccountContinuousScrapeManager, _, _ws = self._import_orch_classes()
|
||||
self._setup_ws_data_dir()
|
||||
try:
|
||||
aid = make_account_id()
|
||||
@@ -825,7 +825,7 @@ class TestSecurityHardening:
|
||||
assert handler.read_json_body() == {}
|
||||
|
||||
def test_check_same_origin_rejects_cross_origin(self):
|
||||
ws = self._ws_module()
|
||||
self._ws_module()
|
||||
|
||||
# cross-origin Origin header -> rejected (403 response sent)
|
||||
h = _make_ws_handler(
|
||||
@@ -1564,5 +1564,6 @@ def cleanup_test_data():
|
||||
shutil.rmtree(str(TEST_TMP), ignore_errors=True)
|
||||
|
||||
|
||||
import atexit # noqa: E402
|
||||
atexit.register(cleanup_test_data) # noqa: E402
|
||||
import atexit
|
||||
|
||||
atexit.register(cleanup_test_data)
|
||||
|
||||
Reference in New Issue
Block a user