314dc03b0d
Moves the orchestrator into bot_bottle/orchestrator/ so one install gets everything. Entry point is now `python -m bot_bottle.orchestrator run`. - Add bot_bottle/orchestrator/ with all 14 modules (verbatim move; internal imports were already relative, so no changes inside orchestrator modules) - Rewrite bootstrap.py: remove the lazy bot_bottle import guard, use direct relative imports from ..contrib.* - Add bot_bottle/contrib/forge/base.py: ScopedForge (read-anywhere / write-scoped) - Add bot_bottle/contrib/gitea/client.py: GiteaClient + GiteaForge (urllib.request only) - Add bot_bottle/contrib/gitea/forge_state.py: ForgeState + SqliteForgeStateStore - Add tests/unit/orchestrator/ (82 tests: 63 migrated + 19 new for contrib modules) Closes #321
39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
"""Unit: Config.from_env."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
from bot_bottle.orchestrator.config import Config
|
|
|
|
|
|
class ConfigTest(unittest.TestCase):
|
|
def test_defaults(self):
|
|
c = Config.from_env({"HOME": "/home/x"})
|
|
self.assertEqual("bot-bottle", c.forge_org)
|
|
self.assertEqual(1800, c.watchdog_timeout_secs)
|
|
self.assertEqual("127.0.0.1", c.webhook_host)
|
|
self.assertEqual(8477, c.webhook_port)
|
|
self.assertEqual(Path("/home/x/.bot-bottle/forge-queue"), c.queue_dir)
|
|
self.assertIsNone(c.db_path)
|
|
|
|
def test_overrides(self):
|
|
c = Config.from_env({
|
|
"HOME": "/home/x",
|
|
"FORGE_ORG": "agents",
|
|
"FORGE_WATCHDOG_TIMEOUT": "60",
|
|
"FORGE_GITEA_API": "https://g.example/api/v1",
|
|
"FORGE_WEBHOOK_PORT": "9000",
|
|
"FORGE_DB_PATH": "/data/bb.db",
|
|
})
|
|
self.assertEqual("agents", c.forge_org)
|
|
self.assertEqual(60, c.watchdog_timeout_secs)
|
|
self.assertEqual("https://g.example/api/v1", c.gitea_api)
|
|
self.assertEqual(9000, c.webhook_port)
|
|
self.assertEqual(Path("/data/bb.db"), c.db_path)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|