test: add unit tests to pass diff-coverage gate (91%)
test / unit (pull_request) Successful in 57s
test / integration (pull_request) Successful in 16s
test / coverage (pull_request) Successful in 1m4s
lint / lint (push) Successful in 1m56s
prd-number / assign-numbers (push) Successful in 19s
test / unit (push) Successful in 1m0s
test / integration (push) Successful in 19s
test / coverage (push) Successful in 1m5s
Update Quality Badges / update-badges (push) Failing after 59s
test / unit (pull_request) Successful in 57s
test / integration (pull_request) Successful in 16s
test / coverage (pull_request) Successful in 1m4s
lint / lint (push) Successful in 1m56s
prd-number / assign-numbers (push) Successful in 19s
test / unit (push) Successful in 1m0s
test / integration (push) Successful in 19s
test / coverage (push) Successful in 1m5s
Update Quality Badges / update-badges (push) Failing after 59s
Cover the new production lines added on this branch: - cli/__init__: MissingEnvVarError maps to return 1 - cli/start: no-agents-defined path, prepare_with_preflight calls render_preflight, _text_render_preflight backend name output - env: resolve_env raises MissingEnvVarError for missing interpolated var - smolmachines/launch: _proxy_host Linux/non-Linux branches, _discover_urls git-gate host and supervise URL stamping Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit was merged in pull request #284.
This commit is contained in:
@@ -9,7 +9,11 @@ from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
|
||||
from bot_bottle.manifest import ManifestBottle, ManifestIndex
|
||||
from unittest.mock import patch
|
||||
|
||||
from bot_bottle.env import resolve_env
|
||||
from bot_bottle.errors import MissingEnvVarError
|
||||
from bot_bottle.manifest import Manifest, ManifestBottle, ManifestIndex
|
||||
from bot_bottle.manifest_agent import (
|
||||
ManifestAgent,
|
||||
ManifestAgentProvider,
|
||||
@@ -238,5 +242,26 @@ class TestEagerIndexLookups(unittest.TestCase):
|
||||
self.assertIsNone(m.git_identity_summary())
|
||||
|
||||
|
||||
class TestResolveEnv(unittest.TestCase):
|
||||
"""resolve_env raises MissingEnvVarError when an interpolated entry's
|
||||
host var is unset."""
|
||||
|
||||
def _manifest(self, env_dict: dict[str, str]) -> Manifest:
|
||||
idx = ManifestIndex.from_json_obj({
|
||||
"bottles": {"dev": {"env": env_dict}},
|
||||
"agents": {"demo": {"bottle": "dev"}},
|
||||
})
|
||||
return idx.load_for_agent("demo")
|
||||
|
||||
def test_missing_interpolated_host_var_raises(self):
|
||||
manifest = self._manifest({"API_KEY": "${HOST_API_KEY}"})
|
||||
with patch.dict("os.environ", {}, clear=False):
|
||||
import os
|
||||
os.environ.pop("HOST_API_KEY", None)
|
||||
with self.assertRaises(MissingEnvVarError) as cm:
|
||||
resolve_env(manifest)
|
||||
self.assertIn("HOST_API_KEY", str(cm.exception))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user