def test_admin_attach_console_error(self): conn = Connection(hostname='Router', start=['mock_device_cli --os iosxr --state enable1'], os='iosxr', enable_password='******') with self.assertRaises(SubCommandFailure): with conn.admin_attach_console('0/abc', timeout=5) as console: console.execute('pwd', timeout=8)
def test_admin_attach_console(self): conn = Connection(hostname='Router', start=['mock_device_cli --os iosxr --state enable1'], os='iosxr', enable_password='******') with conn.admin_attach_console('0/RP0') as console: out = console.execute('pwd') self.assertIn('/misc/disk1', out) ret = conn.spawn.match.match_output self.assertIn('exit', ret) self.assertIn('Router#', ret)