test(server): add unit tests for context, control, and state mixins
Adds comprehensive test coverage for the amc_server package: - test_context.py: Tests _resolve_zellij_bin preference order (which first, then fallback to bare name) - test_control.py: Tests SessionControlMixin including two-step Enter injection with configurable delay, freeform response handling, plugin inject with explicit session/pane targeting, and unsafe fallback behavior - test_state.py: Tests StateMixin zellij session parsing with the resolved binary path Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
20
tests/test_context.py
Normal file
20
tests/test_context.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from amc_server.context import _resolve_zellij_bin
|
||||
|
||||
|
||||
class ContextTests(unittest.TestCase):
|
||||
def test_resolve_zellij_bin_prefers_which(self):
|
||||
with patch("amc_server.context.shutil.which", return_value="/custom/bin/zellij"):
|
||||
self.assertEqual(_resolve_zellij_bin(), "/custom/bin/zellij")
|
||||
|
||||
def test_resolve_zellij_bin_falls_back_to_default_name(self):
|
||||
with patch("amc_server.context.shutil.which", return_value=None), patch(
|
||||
"amc_server.context.Path.exists", return_value=False
|
||||
), patch("amc_server.context.Path.is_file", return_value=False):
|
||||
self.assertEqual(_resolve_zellij_bin(), "zellij")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user