moo.shell.tests.test_server
Tests for moo.shell.server — SSH session lifecycle and authentication logic.
Tests that require a live asyncssh server (interact, server()) are excluded; the testable surface is MooPromptToolkitSSHSession, SSHServer auth methods, and session_requested().
Functions
End-to-end dance: client says WILL TTYPE, server asks three times, client finishes with an MTTS bitfield. |
|
End-to-end: a client that enables GMCP via DO (without running TTYPE) should see the |
|
data_received pulls IAC frames out of the surrogate-escaped str stream and forwards plain text to prompt_toolkit's input pipe. |
|
Editor.Cancel removes the pending edit without invoking the callback. |
|
Editor.Save with a known edit_id schedules invoke_verb.delay with the saved metadata. |
|
Editor.Save bound to a non-wizard caller is dropped without dispatching. |
|
An Editor.Save with an unknown edit_id logs and returns without crashing. |
|
The TERM heuristic gates everything IAC-related. |
|
The _on_gmcp top-level dispatcher routes Core.Supports.Set to the recorder. |
|
Core.Supports.Add merges into existing gmcp_packages without clearing. |
|
A malformed payload (not a list) is ignored without raising. |
|
Core.Supports.Remove pops named packages; version field on remove is optional. |
|
Core.Supports.Set wipes any existing gmcp_packages and installs the new list. |
|
session_requested() returns a MooPromptToolkitSSHSession with user assigned. |
|
|
A vanilla SSH session must wipe any leftover iac cache from a previous MUD-client session. |
A normal terminal (e.g. xterm-256color) produces rich mode. |
|
xterm-256-basic opts into IAC; vanilla xterm leaves the channel untouched. |
|
|
The legacy TERM=moo-automation special case has been removed; treated as a vanilla terminal. |
|
For MUD-client TERM, session_started flips the channel encoding to surrogate-escape UTF-8 so 0xFF IAC bytes round-trip cleanly. |
A non-MUD TERM (e.g. left over from the retired moo-automation client) skips IAC negotiation. |
|
TERM=xterm-256-basic selects raw mode; whitespace and case are tolerated. |
|
validate_password returns True and sets server.user when password is correct. |
|
validate_password returns False when the password is wrong. |
|
validate_password returns False (not an exception) for an unknown username. |