<s> from twisted . trial . unittest import TestCase <EOL> from carnifex . command import PosixCommand <EOL> from carnifex . ssh . command import SSHCommand <EOL> class PosixCommandTest ( TestCase ) : <EOL> def test_posix_command_from_command_line ( self ) : <EOL> executable = '<STR_LIT>' <EOL> args = [ '<STR_LIT>' , '<STR_LIT:value>' , '<STR_LIT>' ] <EOL> commandLine = "<STR_LIT>" % ( executable , '<STR_LIT:U+0020>' . join ( args ) ) <EOL> posixCommand = PosixCommand ( commandLine ) <EOL> self . assertEqual ( posixCommand . executable , executable ) <EOL> self . assertEqual ( posixCommand . args , [ executable ] + args ) <EOL> def test_posix_command_from_args ( self ) : <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:value>' , '<STR_LIT>' ] <EOL> posixCommand = PosixCommand ( args ) <EOL> self . assertEqual ( posixCommand . executable , args [ <NUM_LIT:0> ] ) <EOL> self . assertEqual ( posixCommand . args , args ) <EOL> def test_posix_command_from_executable_and_args ( self ) : <EOL> executable = '<STR_LIT>' <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:value>' , '<STR_LIT>' ] <EOL> posixCommand = PosixCommand ( executable , args ) <EOL> self . assertEqual ( posixCommand . executable , executable ) <EOL> self . assertEqual ( posixCommand . args , args ) <EOL> def test_posix_command_fix_args ( self ) : <EOL> executable = '<STR_LIT>' <EOL> args = [ '<STR_LIT>' , '<STR_LIT:value>' , '<STR_LIT>' ] <EOL> posixCommand = PosixCommand ( executable , args ) <EOL> self . assertEqual ( posixCommand . executable , executable ) <EOL> self . assertEqual ( posixCommand . args , [ executable ] + args ) <EOL> def test_posix_command_ambiguous ( self ) : <EOL> executable = '<STR_LIT>' <EOL> args = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:value>' , '<STR_LIT>' ] <EOL> self . failUnlessRaises ( Exception , PosixCommand , executable , args ) <EOL> class SSHCommandTest ( TestCase ) : <EOL> def test_ssh_command_with_precursor_and_path ( self ) : <EOL> sshCommand = SSHCommand ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> sshCommand . cd = '<STR_LIT>' <EOL> sshCommand . sep = '<STR_LIT:#>' <EOL> self . assertEqual ( sshCommand . getCommandLine ( ) , <EOL> '<STR_LIT>' ) </s>
