Release version 0.4.0
This commit is contained in:
@@ -11,8 +11,8 @@ class TestIntegrationBranchCommands(unittest.TestCase):
|
||||
Integration tests for the `pkgmgr branch` CLI wiring.
|
||||
|
||||
These tests execute the real entry point (main.py) and mock
|
||||
the high-level `open_branch` helper to ensure that argument
|
||||
parsing and dispatch behave as expected.
|
||||
the high-level helpers to ensure that argument parsing and
|
||||
dispatch behave as expected.
|
||||
"""
|
||||
|
||||
def _run_pkgmgr(self, extra_args: list[str]) -> None:
|
||||
@@ -64,6 +64,46 @@ class TestIntegrationBranchCommands(unittest.TestCase):
|
||||
self.assertEqual(kwargs.get("base_branch"), "main")
|
||||
self.assertEqual(kwargs.get("cwd"), ".")
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# close subcommand
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
@patch("pkgmgr.cli_core.commands.branch.close_branch")
|
||||
def test_branch_close_with_name_and_base(self, mock_close_branch) -> None:
|
||||
"""
|
||||
`pkgmgr branch close feature/test --base develop` must forward
|
||||
the name and base branch to close_branch() with cwd=".".
|
||||
"""
|
||||
self._run_pkgmgr(
|
||||
["branch", "close", "feature/test", "--base", "develop"]
|
||||
)
|
||||
|
||||
mock_close_branch.assert_called_once()
|
||||
_, kwargs = mock_close_branch.call_args
|
||||
self.assertEqual(kwargs.get("name"), "feature/test")
|
||||
self.assertEqual(kwargs.get("base_branch"), "develop")
|
||||
self.assertEqual(kwargs.get("cwd"), ".")
|
||||
|
||||
@patch("pkgmgr.cli_core.commands.branch.close_branch")
|
||||
def test_branch_close_without_name_uses_default_base(
|
||||
self,
|
||||
mock_close_branch,
|
||||
) -> None:
|
||||
"""
|
||||
`pkgmgr branch close` without a name must still call close_branch(),
|
||||
passing name=None and the default base branch 'main'.
|
||||
|
||||
The branch helper will then resolve the actual base (main/master)
|
||||
internally.
|
||||
"""
|
||||
self._run_pkgmgr(["branch", "close"])
|
||||
|
||||
mock_close_branch.assert_called_once()
|
||||
_, kwargs = mock_close_branch.call_args
|
||||
self.assertIsNone(kwargs.get("name"))
|
||||
self.assertEqual(kwargs.get("base_branch"), "main")
|
||||
self.assertEqual(kwargs.get("cwd"), ".")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user