def test_crash(self): ssh = connection.connect(HOST) e = assert_raises( CommandCrashedError, run.run, client=ssh, args=['sh', '-c', 'kill -ABRT $$'], ) assert e.command == "sh -c 'kill -ABRT $$'" assert str(e) == "Command crashed: \"sh -c 'kill -ABRT $$'\""
def test_lost(self): ssh = connection.connect(HOST) e = assert_raises( ConnectionLostError, run.run, client=ssh, args=['sh', '-c', 'kill -ABRT $PPID'], ) assert e.command == "sh -c 'kill -ABRT $PPID'" assert str(e) == \ "SSH connection was lost: \"sh -c 'kill -ABRT $PPID'\""
def test_lost(self): ssh = connection.connect(HOST) e = assert_raises( ConnectionLostError, run.run, client=ssh, args=['sh', '-c', 'kill -ABRT $PPID'], name=HOST, ) assert e.command == "sh -c 'kill -ABRT $PPID'" assert str(e) == \ "SSH connection to {host} was lost: ".format(host=HOST) + \ "\"sh -c 'kill -ABRT $PPID'\""
def test_split_user_empty_user(self): s = '@somehost.example.com' e = assert_raises(AssertionError, connection.split_user, s) assert str(e) == 'Bad input to split_user: {s!r}'.format(s=s)