mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 02:00:46 +08:00
fix(webcrt): replay login banner/prompt on attach
Drain and nudge the device prompt after Netmiko login, replay bootstrap stdout when the WebSocket attaches, and surface connect errors in the terminal pane. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
8e3bed562f
commit
30f2db9708
6 changed files with 87 additions and 9 deletions
|
|
@ -145,8 +145,11 @@ class WebcrtServiceTests(unittest.TestCase):
|
|||
self.assertEqual(out["ne_id"], "ne-hop")
|
||||
sess = svc.get_session(out["session_id"])
|
||||
assert sess is not None
|
||||
# create_session may nudge Enter when no prompt was drained.
|
||||
before = list(fake.written)
|
||||
sess.write_stdin("\n")
|
||||
self.assertEqual(fake.written, ["\n"])
|
||||
self.assertEqual(fake.written[len(before) :], ["\n"])
|
||||
self.assertTrue(isinstance(sess.bootstrap_output, (bytes, bytearray)))
|
||||
svc.close_session(out["session_id"], reason="test")
|
||||
|
||||
@patch.object(svc, "_audit")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue