Add entry and delete entry functionality with modals in TUI application
- Implemented add_entry method in HostsManager for adding new entries. - Created AddEntryModal for user input when adding entries. - Implemented delete_entry method in HostsManager for removing entries. - Created DeleteConfirmationModal for user confirmation before deletion. - Integrated modals into HostsManagerApp for adding and deleting entries. - Added search functionality with SearchModal for finding entries by hostname or IP address. - Updated keybindings to include shortcuts for adding and deleting entries. - Added HelpModal to provide keyboard shortcuts and usage information.
This commit is contained in:
parent
8b8c02c6da
commit
07e7e4f70f
8 changed files with 966 additions and 10 deletions
|
@ -324,14 +324,17 @@ class TestHostsManagerApp:
|
|||
patch("hosts.tui.app.Config", return_value=mock_config),
|
||||
):
|
||||
app = HostsManagerApp()
|
||||
app.update_status = Mock()
|
||||
app.push_screen = Mock()
|
||||
|
||||
app.action_help()
|
||||
|
||||
# Should update status with help message
|
||||
app.update_status.assert_called_once()
|
||||
call_args = app.update_status.call_args[0][0]
|
||||
assert "Help:" in call_args
|
||||
# Should push the help modal screen
|
||||
app.push_screen.assert_called_once()
|
||||
# Verify the modal is a HelpModal instance
|
||||
from hosts.tui.help_modal import HelpModal
|
||||
|
||||
args = app.push_screen.call_args[0]
|
||||
assert isinstance(args[0], HelpModal)
|
||||
|
||||
def test_action_config(self):
|
||||
"""Test config action opens modal."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue