Skip to content

Commit

Permalink
improved test case for SSHCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
lirazsiri committed Jul 20, 2011
1 parent b1abc2d commit d4ddd14
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/ssh.py
Expand Up @@ -2,11 +2,21 @@
import sys
from command import Command

class SSHCommand(Command):
def __init__(self, address, command):
opts = ('StrictHostKeyChecking=no',
'PasswordAuthentication=no')

argv = ['ssh']
for opt in opts:
argv += [ "-o", opt ]

argv += [ address, command ]
Command.__init__(self, argv, setpgrp=True)

command = 'echo HOME=$HOME; echo pid=$$; (while true; do sleep 1; echo hello; done)'
args = ('ssh',
'd',
command)
c = Command(args, setpgrp=True)

c = SSHCommand('d', command)
def cb(c, buf):
if buf:
sys.stdout.write(buf)
Expand Down

0 comments on commit d4ddd14

Please sign in to comment.