test: annotate _git_repo helper to satisfy pyright strict mode
test / integration-docker (push) Successful in 13s
Update Quality Badges / update-badges (push) Successful in 40s
lint / lint (push) Successful in 53s
test / integration-firecracker (push) Successful in 4m56s
test / unit (push) Failing after 33s
test / coverage (push) Has been skipped
test / publish-infra (push) Has been skipped
test / integration-docker (push) Successful in 13s
Update Quality Badges / update-badges (push) Successful in 40s
lint / lint (push) Successful in 53s
test / integration-firecracker (push) Successful in 4m56s
test / unit (push) Failing after 33s
test / coverage (push) Has been skipped
test / publish-infra (push) Has been skipped
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit was merged in pull request #464.
This commit is contained in:
@@ -25,6 +25,10 @@ def _bottle(**kwargs: object) -> ManifestBottle:
|
||||
return ManifestBottle.from_dict("test", kwargs)
|
||||
|
||||
|
||||
def _git_repo(url: str) -> dict[str, object]:
|
||||
return {"url": url, "key": {"provider": "gitea", "forge_token_env": "TOK"}}
|
||||
|
||||
|
||||
class TestMergeBottlesRuntime(unittest.TestCase):
|
||||
def test_single_bottle_returns_as_is(self):
|
||||
b = _bottle(env={"FOO": "1"})
|
||||
@@ -118,23 +122,20 @@ class TestMergeBottlesRuntime(unittest.TestCase):
|
||||
def test_git_repo_only_in_override_does_not_raise(self):
|
||||
# Regression for issue #457: override bottle declares a repo that the
|
||||
# base doesn't have → KeyError on base_repos_by_name[n].
|
||||
_repo = lambda url: {"url": url, "key": {"provider": "gitea", "forge_token_env": "TOK"}}
|
||||
base = _bottle(env={"X": "base"})
|
||||
override = _bottle(**{"git-gate": {"repos": {"myrepo": _repo("ssh://git@example.com/repo.git")}}})
|
||||
override = _bottle(**{"git-gate": {"repos": {"myrepo": _git_repo("ssh://git@example.com/repo.git")}}})
|
||||
result = merge_bottles_runtime([base, override])
|
||||
self.assertIn("myrepo", [e.Name for e in result.git])
|
||||
|
||||
def test_git_repo_only_in_base_survives_override(self):
|
||||
_repo = lambda url: {"url": url, "key": {"provider": "gitea", "forge_token_env": "TOK"}}
|
||||
base = _bottle(**{"git-gate": {"repos": {"myrepo": _repo("ssh://git@example.com/repo.git")}}})
|
||||
base = _bottle(**{"git-gate": {"repos": {"myrepo": _git_repo("ssh://git@example.com/repo.git")}}})
|
||||
override = _bottle(env={"X": "override"})
|
||||
result = merge_bottles_runtime([base, override])
|
||||
self.assertIn("myrepo", [e.Name for e in result.git])
|
||||
|
||||
def test_git_repo_override_wins_by_name(self):
|
||||
_repo = lambda url: {"url": url, "key": {"provider": "gitea", "forge_token_env": "TOK"}}
|
||||
base = _bottle(**{"git-gate": {"repos": {"myrepo": _repo("ssh://git@base.example.com/repo.git")}}})
|
||||
override = _bottle(**{"git-gate": {"repos": {"myrepo": _repo("ssh://git@override.example.com/repo.git")}}})
|
||||
base = _bottle(**{"git-gate": {"repos": {"myrepo": _git_repo("ssh://git@base.example.com/repo.git")}}})
|
||||
override = _bottle(**{"git-gate": {"repos": {"myrepo": _git_repo("ssh://git@override.example.com/repo.git")}}})
|
||||
result = merge_bottles_runtime([base, override])
|
||||
self.assertEqual(1, len(result.git))
|
||||
self.assertEqual("ssh://git@override.example.com/repo.git", result.git[0].Upstream)
|
||||
|
||||
Reference in New Issue
Block a user