Files
computer-playbook/tests/unit/cli/deploy/dedicated/test_main.py
T
kevinveenbirkenbach ea63818216 refactor(cli): simplify dedicated deploy wrapper and add ansible passthrough support
- Remove unused cli_root and logs handling from dedicated deploy wrapper
- Add parse_known_args() to forward native ansible-playbook flags
- Append passthrough args at the end for proper override behavior
- Clean up MODE_LOGS usage
- Update runner signature and cleanup phase logic
- Adapt unit tests to new wrapper contract
- Add unit test for ansible flag passthrough in command.main()

https://chatgpt.com/share/69694ad5-453c-800f-8047-cf210f60460f
2026-01-15 21:15:06 +01:00

30 lines
861 B
Python

from __future__ import annotations
import unittest
from cli.deploy.dedicated import command as dedicated_main
class TestDedicatedMainParser(unittest.TestCase):
def test_build_parser_has_expected_core_args(self):
parser = dedicated_main.build_parser()
# Smoke-check: parser exists and has some core options
opts = {a.dest for a in parser._actions} # noqa: SLF001 (test-only introspection)
self.assertIn("inventory", opts)
self.assertIn("limit", opts)
self.assertIn("host_type", opts)
self.assertIn("password_file", opts)
self.assertIn("skip_build", opts)
self.assertIn("id", opts)
self.assertIn("verbose", opts)
self.assertIn("diff", opts)
# Removed in the refactor
self.assertNotIn("logs", opts)
if __name__ == "__main__":
unittest.main()