Merge origin/main; warn on partial proxy credentials; add only-password test

- Merged latest main (no conflicts)
- Added warning log when only one of proxy_username/proxy_password is set
- Added test_start_no_proxy_auth_when_only_password for coverage parity

Made-with: Cursor
This commit is contained in:
Xubin Ren
2026-04-09 23:54:11 +08:00
committed by Xubin Ren
parent 7506af7104
commit 69d748bf8f
2 changed files with 30 additions and 1 deletions
+22
View File
@@ -845,3 +845,25 @@ async def test_start_no_proxy_auth_when_only_username(monkeypatch) -> None:
assert channel.is_running is False
assert _FakeDiscordClient.instances[0].proxy_auth is None
@pytest.mark.asyncio
async def test_start_no_proxy_auth_when_only_password(monkeypatch) -> None:
_FakeDiscordClient.instances.clear()
channel = DiscordChannel(
DiscordConfig(
enabled=True,
token="token",
allow_from=["*"],
proxy="http://127.0.0.1:7890",
proxy_password="pass",
),
MessageBus(),
)
monkeypatch.setattr("nanobot.channels.discord.DiscordBotClient", _FakeDiscordClient)
await channel.start()
assert channel.is_running is False
assert _FakeDiscordClient.instances[0].proxy == "http://127.0.0.1:7890"
assert _FakeDiscordClient.instances[0].proxy_auth is None