Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Unified Diff: third_party/pexpect/tests/fakessh/ssh

Issue 1398903002: Add third_party/pexpect (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@end-to-end-test
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/pexpect/tests/exit667.c ('k') | third_party/pexpect/tests/getch.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pexpect/tests/fakessh/ssh
diff --git a/third_party/pexpect/tests/fakessh/ssh b/third_party/pexpect/tests/fakessh/ssh
new file mode 100644
index 0000000000000000000000000000000000000000..28eedc4302b0bd3f8f2922c84a883e81a5dd9602
--- /dev/null
+++ b/third_party/pexpect/tests/fakessh/ssh
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+from __future__ import print_function
+
+import getpass
+import sys
+PY3 = (sys.version_info[0] >= 3)
+if not PY3:
+ input = raw_input
+
+print("Mock SSH client for tests. Do not enter real security info.")
+
+pw = getpass.getpass('password:')
+if pw != 's3cret':
+ print('Permission denied!')
+ sys.exit(1)
+
+prompt = "$"
+while True:
+ cmd = input(prompt)
+ if cmd.startswith('PS1='):
+ prompt = eval(cmd[4:]).replace('\$', '$')
+ elif cmd == 'ping':
+ print('pong')
+ elif cmd.startswith('ls'):
+ print('file1.py', 'file2.html', sep='\t')
+ elif cmd == 'echo $?':
+ print(0)
+ elif cmd in ('exit', 'logout'):
+ break
« no previous file with comments | « third_party/pexpect/tests/exit667.c ('k') | third_party/pexpect/tests/getch.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698