test: remove obsolete nonexistence checks

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-05 23:58:38 +08:00
1 parent c08172a641
commit 3495281282
24 files changed
+8 -407

No files matched your search

@@ -4,7 +4,7 @@ import pytest
from nanobot.channels.email import validation as email_validation
from nanobot.channels.validation import validate_channel_config
from nanobot.config.loader import load_config, save_config
from nanobot.config.loader import save_config
from nanobot.config.schema import Config
@@ -14,6 +14,7 @@ def test_validate_email_presets_are_checked_without_saving(
) -> None:
config_path = tmp_path / "config.json"
save_config(Config(), config_path)
original_config = config_path.read_bytes()
monkeypatch.setattr("nanobot.config.loader._current_config_path", config_path)
monkeypatch.setattr(email_validation, "probe_tcp", lambda *_args, **_kwargs: None)
@@ -32,7 +33,7 @@ def test_validate_email_presets_are_checked_without_saving(
assert result["status"] == "connected"
assert result["can_enable"] is True
assert not hasattr(load_config(config_path).channels, "email")
assert config_path.read_bytes() == original_config
def test_validate_email_blocks_private_targets_when_local_access_is_disabled(
@@ -341,26 +341,6 @@ async def test_sessions_list_and_thread_restore_transcript_without_canonical_fil
await server_task
@pytest.mark.asyncio
async def test_legacy_session_messages_route_is_not_exposed(
bus: MagicMock, tmp_path: Path
) -> None:
sm = _seed_session(tmp_path, key="websocket:legacy")
channel = _ch(bus, session_manager=sm, port=29919)
server_task = asyncio.create_task(channel.start())
try:
token = channel.gateway.tokens.issue_api_token(300)
response = await _http_get(
"http://127.0.0.1:29919/api/sessions/websocket:legacy/messages",
headers={"Authorization": f"Bearer {token}"},
)
assert response.status_code == 404
finally:
await channel.stop()
await server_task
@pytest.mark.asyncio
async def test_session_automations_route_filters_by_webui_session(
bus: MagicMock, tmp_path: Path
@@ -157,11 +157,9 @@ class _FailingConnectLoginClient(_FakeLoginClient):
return asyncio.create_task(fail())
def test_default_config_has_no_bridge_fields() -> None:
def test_default_config_uses_native_database_path() -> None:
config = WhatsAppChannel.default_config()
assert "bridgeUrl" not in config
assert "bridgeToken" not in config
assert config["databasePath"] == ""